From 50bad47557178365af48f35b244f287f393fb3b1 Mon Sep 17 00:00:00 2001 From: velramiir Date: Wed, 27 Sep 2023 17:38:37 +0200 Subject: [PATCH] chore: run manual release --- .github/workflows/create-release.yml | 149 +++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..c4e76e3 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,149 @@ +name: Create Release + +on: + push: + branches: + - chore/run-release-4.0.1-manually + # workflow_call: + # secrets: + # GH_BOT_USER: + # required: true + # GH_BOT_PAT: + # required: true + # CR_PAT: + # required: true + # outputs: + # tag: + # description: "The semver tag generated for the created release e.g. v1.2.3" + # value: ${{ jobs.create-release.outputs.tag }} + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-latest + # outputs: + # tag: ${{ steps.changelog.outputs.tag }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_BOT_PAT }} + ref: "release" + + # - name: Check Out .github Repository + # uses: actions/checkout@v3 + # with: + # repository: "dot-base/.github" + # ref: "main" + # path: "actions-repo" + # token: ${{ secrets.GH_BOT_PAT }} + + # - name: Install conventional-changelog + # run: | + # npm i conventional-changelog-conventionalcommits + + # - name: Generate Changelog + # id: changelog + # uses: TriPSs/conventional-changelog-action@v3 + # with: + # github-token: ${{ secrets.github_token }} + # release-count: 0 # keep all changes in changelog + # output-file: "false" + # skip-version-file: "true" + # skip-commit: "true" + # git-push: "false" + # config-file-path: "actions-repo/.github/changelog.config.js" + + # - name: Create GitHub Release + # uses: actions/create-release@v1 + # if: ${{ steps.changelog.outputs.skipped == 'false' }} + # env: + # GITHUB_TOKEN: ${{ secrets.GH_BOT_PAT }} + # with: + # commitish: "release" + # tag_name: ${{ steps.changelog.outputs.tag }} + # release_name: ${{ steps.changelog.outputs.tag }} + # body: ${{ steps.changelog.outputs.clean_changelog }} + + # - name: Fast Forward main to release + # run: | + # git reset --hard + # git checkout main + # git merge --ff-only origin/release + # git push + + # - name: Manage Milestones + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.GH_BOT_PAT }} + # script: | + # // get next milestone + # const milestones = await github.paginate('GET /repos/{owner}/{repo}/milestones', { + # owner: context.repo.owner, + # repo: context.repo.repo + # }) + # const currentMilestone = milestones.find((m) => m.title === 'next'); + + # // update current next milestone to released version + # if(currentMilestone) { + # console.log('Renaming and closing current milestone'); + # await github.request('PATCH /repos/{owner}/{repo}/milestones/{milestone_number}', { + # owner: context.repo.owner, + # repo: context.repo.repo, + # milestone_number: currentMilestone.number, + # title: '${{ steps.changelog.outputs.tag }}', + # state: 'closed' + # }); + # } + + # // create new next milestone + # console.log('Opening new "next" milestone'); + # const nextMilestone = await github.request('POST /repos/{owner}/{repo}/milestones', { + # owner: context.repo.owner, + # repo: context.repo.repo, + # title: 'next' + # }); + + # // fetch open PRs to to set new "next" milestone + # console.log('Set milestone of open PRs to new "next"'); + # const pulls = await github.paginate('GET /repos/{owner}/{repo}/pulls?state=open', { + # owner: context.repo.owner, + # repo: context.repo.repo, + # }); + + # // set milestone of open PRs to new "next" + # for (const pull of pulls) { + # await github.request('PATCH /repos/{owner}/{repo}/issues/{pull_request_number}', { + # owner: context.repo.owner, + # repo: context.repo.repo, + # pull_request_number: pull.number, + # milestone: nextMilestone.data.number + # }); + # } + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and Publish Docker Image @:latest and @:v_._._ + run: | + # copose image ID and change all uppercase to lowercase + IMAGE_ID=ghcr.io/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # get version and strip v from the front + VERSION="v4.0.1" + VERSION=$(echo $VERSION | sed -e 's/^v//') + + # log into docker registry + echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + # build docker image and push to registry + docker buildx build . \ + --file Dockerfile \ + --tag $IMAGE_ID:latest \ + --tag $IMAGE_ID:$VERSION \ + --platform linux/amd64,linux/arm64 \ + --push