From 547899d94d775bc730bf954d67ff4ec74db111d4 Mon Sep 17 00:00:00 2001 From: Joseph Petersen Date: Sun, 16 Jan 2022 19:02:23 +0100 Subject: [PATCH 1/3] add automatic release of release-drafter --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ Dockerfile | 4 +-- package.json | 4 +-- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..2d180af02 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release +on: + push: + tags: + - v* +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: "16" + cache: "yarn" + registry-url: "https://registry.npmjs.org" + + - name: yarn install + run: yarn install --frozen-lockfile + + - name: yarn test + run: yarn test + + - name: yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} + run: yarn publish --access public + + - name: Deploy to Heroku + env: + HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }} + HEROKU_APP_NAME: "release-drafter" + run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master + + - name: version + id: version + run: | + version=${{ github.event.release.tag_name }} + version=${version#v} + echo "::set-output name=version::${version}" + + - uses: release-drafter/release-drafter@master + with: + version: "{{ steps.version.outputs.version }}" + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 11e2cccd5..7ee0d1b46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM node:17.3.1-alpine@sha256:7ef8e673a9ea7b1dfaae292bf8faf549bb81ba60f68087454cef143698bdf2c4 ARG NODE_ENV=production ENV NODE_ENV=${NODE_ENV} -LABEL "repository"="https://github.com/toolmantim/release-drafter" -LABEL "homepage"="https://github.com/toolmantim/release-drafter" +LABEL "repository"="https://github.com/release-drafter/release-drafter" +LABEL "homepage"="https://github.com/release-drafter/release-drafter" LABEL "maintainer"="Tim Lucas" LABEL "com.github.actions.name"="Release Drafter" LABEL "com.github.actions.description"="Drafts your next release notes as pull requests are merged into master." diff --git a/package.json b/package.json index 4112d33c0..f0983a93e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "A GitHub app that draft releases based on pull-request labels", "author": "Tim Lucas (https://github.com/toolmantim)", "license": "ISC", - "repository": "https://github.com/toolmantim/release-drafter", + "repository": "https://github.com/release-drafter/release-drafter", "scripts": { "build": "ncc build action.js --target es2021", "dev": "nodemon --exec \"npm start\"", @@ -16,7 +16,7 @@ "generate-fixtures": "node ./bin/generate-fixtures.js", "lint": "eslint bin/*.js lib/*.js action.js index.js test/**/*.js", "prettier": "prettier --write **/*.{js,md,json,yml,yaml}", - "postversion": "npm run test && git push && git push --tags && npm publish && npm run deploy && npm run open-releases", + "postversion": "npm run test && git push && git push --tags", "open-releases": "open \"$(node -e 'console.log(`${require(\"./package.json\").repository}/releases`)')\"", "deploy": "git push -f heroku \"$(node -e 'console.log(`v${require(\"./package.json\").version}`)')\":master", "prepare": "husky install" From 697f5b045e2f143270f6698fddc03657ef676372 Mon Sep 17 00:00:00 2001 From: Joseph Petersen Date: Sun, 16 Jan 2022 19:06:42 +0100 Subject: [PATCH 2/3] prettier --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d180af02..67490314a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,9 +13,9 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 with: - node-version: "16" - cache: "yarn" - registry-url: "https://registry.npmjs.org" + node-version: '16' + cache: yarn + registry-url: https://registry.npmjs.org - name: yarn install run: yarn install --frozen-lockfile @@ -31,7 +31,7 @@ jobs: - name: Deploy to Heroku env: HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }} - HEROKU_APP_NAME: "release-drafter" + HEROKU_APP_NAME: release-drafter run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master - name: version @@ -43,7 +43,7 @@ jobs: - uses: release-drafter/release-drafter@master with: - version: "{{ steps.version.outputs.version }}" + version: '{{ steps.version.outputs.version }}' publish: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bf573109c4447bc52fb4d8f68cc1c319de77f5fa Mon Sep 17 00:00:00 2001 From: Joseph Petersen Date: Sun, 16 Jan 2022 19:21:50 +0100 Subject: [PATCH 3/3] major tag update --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67490314a..fcb6eda0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: tags: - - v* + - v*.*.* jobs: build: runs-on: ubuntu-latest @@ -39,7 +39,9 @@ jobs: run: | version=${{ github.event.release.tag_name }} version=${version#v} + major=${version%%.*} echo "::set-output name=version::${version}" + echo "::set-output name=major::${major}" - uses: release-drafter/release-drafter@master with: @@ -47,3 +49,8 @@ jobs: publish: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: force update major tag + run: | + git tag v{{ steps.version.outputs.major }} ${{ github.event.release.tag_name }} -f + git push origin refs/tags/v{{ steps.version.outputs.major }} -f