From 9a929d180de4af7ca0797417a43756b6b52406f4 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:35:39 +0100 Subject: [PATCH 01/23] Remove package.json:version (unnecessary) + add an action that releases automatically when a change lands on the main branches --- .github/workflows/auto-git-release.yml | 44 ++++++++++++++++++++++++++ package.json | 1 - 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/auto-git-release.yml diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml new file mode 100644 index 000000000..d109b8ca5 --- /dev/null +++ b/.github/workflows/auto-git-release.yml @@ -0,0 +1,44 @@ +# Summary: +# Automatically tag and release when changes land on the "main" branches. +# +# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v3.1.2 +# See https://github.com/marvinpinto/action-automatic-releases https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0 + +name: 'Auto release' +on: + push: + branches: +# - main +# - master + - 'v2-*' # XXX NRN releases on v2 branches, but you'll likely want to release on either main or master + - '*' # For testing/debugging + +jobs: + tag-and-release: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action + - uses: paulhatch/semantic-version@v3.1.2 + id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 + with: # See https://github.com/PaulHatch/semantic-version#usage + branch: ${GITHUB_REF#refs/heads/} # Use current branch XXX You might want to use main or master + tag_prefix: "v" # The prefix to use to identify tags + major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change + minor_pattern: "(MINOR)" # Same as above except indicating a minor change + format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output + - run: | + echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} + echo "Next version: ${{steps.next_semantic_version.outputs.version}}" + echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" + - uses: marvinpinto/action-automatic-releases@v1.1.0 + with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} + prerelease: true + title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}}" + files: | + README.md + CHANGELOG.md + LICENSE diff --git a/package.json b/package.json index f30242b09..1ef40dc93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "next-right-now", - "version": "1.0.0", "private": true, "scripts": { "start": "next dev --port 8888", From 07a336fdb9a996c700d5d4b9e1c83d2d7aa93dbd Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:38:36 +0100 Subject: [PATCH 02/23] Print current branch --- .github/workflows/auto-git-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index d109b8ca5..053cdb8bf 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -29,6 +29,7 @@ jobs: minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output - run: | + echo "Current branch: ${GITHUB_REF#refs/heads/}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From a7e52aff9223cb03a616d584ef2213a539b4d352 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:42:15 +0100 Subject: [PATCH 03/23] Alternative way to resolve current branch --- .github/workflows/auto-git-release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 053cdb8bf..56a061f67 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,19 +17,23 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: + - name: Extract current branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: ${GITHUB_REF#refs/heads/} # Use current branch XXX You might want to use main or master + branch: ${{ steps.extract_branch.outputs.branch }} # Use current branch XXX You might want to use main or master tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output - run: | - echo "Current branch: ${GITHUB_REF#refs/heads/}" + echo "Current branch: ${{ steps.extract_branch.outputs.branch }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From 224221740ccef8dfe1b7be94c135ce380ae633c8 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:43:56 +0100 Subject: [PATCH 04/23] Alternative way to resolve current branch (2) --- .github/workflows/auto-git-release.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 56a061f67..77038bded 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,23 +17,26 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: - - name: Extract current branch name + - name: Get branch name + if: github.event_name != 'pull_request' shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + - name: Get branch name (pull request) + if: github.event_name == 'pull_request' + shell: bash + run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: ${{ steps.extract_branch.outputs.branch }} # Use current branch XXX You might want to use main or master + branch: ${{ env.BRANCH_NAME }} # Use current branch XXX You might want to use main or master tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output - run: | - echo "Current branch: ${{ steps.extract_branch.outputs.branch }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From ccc63be2259548984632e1e2e1e8cd942a55d8af Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:46:17 +0100 Subject: [PATCH 05/23] Alternative way to resolve current branch (3) --- .github/workflows/auto-git-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 77038bded..1d51ad1b7 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -31,12 +31,13 @@ jobs: - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: ${{ env.BRANCH_NAME }} # Use current branch XXX You might want to use main or master + branch: $BRANCH_NAME # Use current branch XXX You might want to use main or master tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output - run: | + echo "Branch name: $BRANCH_NAME" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From 7bd37eb793ce3c73ffbe986ab2b5c0daa9f8562f Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:51:20 +0100 Subject: [PATCH 06/23] Remove code to see if warning keeps coming --- .github/workflows/auto-git-release.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 1d51ad1b7..57fe26a0a 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,14 +17,6 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: - - name: Get branch name - if: github.event_name != 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - - name: Get branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action From 9678da6f493cf3e43a60bf0427af4b1e53967200 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:56:32 +0100 Subject: [PATCH 07/23] Try using latest --- .github/workflows/auto-git-release.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 57fe26a0a..ce5b8b097 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,6 +17,14 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: + - name: Get branch name + if: github.event_name != 'pull_request' + shell: bash + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV + - name: Get branch name (pull request) + if: github.event_name == 'pull_request' + shell: bash + run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action @@ -33,7 +41,7 @@ jobs: echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" - - uses: marvinpinto/action-automatic-releases@v1.1.0 + - uses: marvinpinto/action-automatic-releases@latest with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} From a2d4753a9e37a6e849bea1f86c91e021dad7ae88 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:58:02 +0100 Subject: [PATCH 08/23] Rety 1.1.0 --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index ce5b8b097..1d51ad1b7 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -41,7 +41,7 @@ jobs: echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" - - uses: marvinpinto/action-automatic-releases@latest + - uses: marvinpinto/action-automatic-releases@v1.1.0 with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} From 59f5dff6e3ec0b92b70615c5793e240867990fce Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 01:59:42 +0100 Subject: [PATCH 09/23] Okay, gotta use latest, hasn't been released under a proper version --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 1d51ad1b7..ce5b8b097 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -41,7 +41,7 @@ jobs: echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" - - uses: marvinpinto/action-automatic-releases@v1.1.0 + - uses: marvinpinto/action-automatic-releases@latest with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} From a4c6fe61d5860b369e7bdfdce82a701d84f2ceb5 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:00:55 +0100 Subject: [PATCH 10/23] Try using fixed version (safer than latest) --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index ce5b8b097..3725f920b 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -41,7 +41,7 @@ jobs: echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" - - uses: marvinpinto/action-automatic-releases@latest + - uses: marvinpinto/action-automatic-releases@ea10bdb242e83fa0fa008b75761761f345a2e5f2 # Pin "latest" https://github.com/marvinpinto/actions/commit/ea10bdb242e83fa0fa008b75761761f345a2e5f2 necessary to avoid "The `set-env` command is disabled." with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} From 9dcd82675e9ebc35d3d6f5f12228c5073a2b624d Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:02:25 +0100 Subject: [PATCH 11/23] Bad commit id (wrong repo) --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 3725f920b..7009bb2a0 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -41,7 +41,7 @@ jobs: echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" - - uses: marvinpinto/action-automatic-releases@ea10bdb242e83fa0fa008b75761761f345a2e5f2 # Pin "latest" https://github.com/marvinpinto/actions/commit/ea10bdb242e83fa0fa008b75761761f345a2e5f2 necessary to avoid "The `set-env` command is disabled." + - uses: marvinpinto/action-automatic-releases@10bdce64abdb4558a2ee6983192242be40d631d8 # Pin "latest" https://github.com/marvinpinto/action-automatic-releases/commit/10bdce64abdb4558a2ee6983192242be40d631d8 necessary to avoid "The `set-env` command is disabled." with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} From dfdd8437091e0010f499ce027e64112e945fc013 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:08:55 +0100 Subject: [PATCH 12/23] Try to handle multiple "main" branches --- .github/workflows/auto-git-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 7009bb2a0..f70c29085 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -35,7 +35,7 @@ jobs: tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change - format: "${major}.${minor}.${patch}-prerelease.${increment}" # A string to determine the format of the version output + format: "${major}.${minor}.${patch}-${BRANCH_NAME}.${increment}" # A string to determine the format of the version output - run: | echo "Branch name: $BRANCH_NAME" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} @@ -44,9 +44,9 @@ jobs: - uses: marvinpinto/action-automatic-releases@10bdce64abdb4558a2ee6983192242be40d631d8 # Pin "latest" https://github.com/marvinpinto/action-automatic-releases/commit/10bdce64abdb4558a2ee6983192242be40d631d8 necessary to avoid "The `set-env` command is disabled." with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} + automatic_release_tag: ${{steps.next_semantic_version.outputs.version}} prerelease: true - title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}}" + title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`$BRANCH_NAME`)" files: | README.md CHANGELOG.md From b234601a180a00f0646feb36b0b2dfe38bec9bac Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:10:36 +0100 Subject: [PATCH 13/23] Fix attempt --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index f70c29085..72d8bdcbd 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -35,7 +35,7 @@ jobs: tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change - format: "${major}.${minor}.${patch}-${BRANCH_NAME}.${increment}" # A string to determine the format of the version output + format: "${major}.${minor}.${patch}-$BRANCH_NAME.${increment}" # A string to determine the format of the version output - run: | echo "Branch name: $BRANCH_NAME" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} From 86f5f5064248867beb8d1d8f32f978a51325e325 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:15:23 +0100 Subject: [PATCH 14/23] Simplify get branch --- .github/workflows/auto-git-release.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 72d8bdcbd..7e1bd56f4 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,27 +17,19 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: - - name: Get branch name - if: github.event_name != 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - - name: Get branch name (pull request) - if: github.event_name == 'pull_request' - shell: bash - run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: $BRANCH_NAME # Use current branch XXX You might want to use main or master + branch: ${{ github.ref }} # Use current branch XXX You might want to use main or master tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-$BRANCH_NAME.${increment}" # A string to determine the format of the version output - run: | - echo "Branch name: $BRANCH_NAME" + echo "Branch name: ${{ github.ref }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From 8a3cff1d3631ce5c8afd3fe8f734ab1b1d580ee2 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:17:01 +0100 Subject: [PATCH 15/23] Forgot stuff --- .github/workflows/auto-git-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 7e1bd56f4..bcbd6c895 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -27,7 +27,7 @@ jobs: tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change - format: "${major}.${minor}.${patch}-$BRANCH_NAME.${increment}" # A string to determine the format of the version output + format: "${major}.${minor}.${patch}-${{ github.ref }}.${increment}" # A string to determine the format of the version output - run: | echo "Branch name: ${{ github.ref }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} @@ -38,7 +38,7 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version}} prerelease: true - title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`$BRANCH_NAME`)" + title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`${{ github.ref }}`)" files: | README.md CHANGELOG.md From 209866a6c29907e60e86881da20d00c43a81cfae Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:18:59 +0100 Subject: [PATCH 16/23] Try ignoring #refs/heads/ --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index bcbd6c895..70a64c51a 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -29,7 +29,7 @@ jobs: minor_pattern: "(MINOR)" # Same as above except indicating a minor change format: "${major}.${minor}.${patch}-${{ github.ref }}.${increment}" # A string to determine the format of the version output - run: | - echo "Branch name: ${{ github.ref }}" + echo "Branch name: ${{ github.ref#refs/heads/ }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" From 5e384602ede587496322e977ea5baa06a9eceef7 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:27:41 +0100 Subject: [PATCH 17/23] Try another way --- .github/workflows/auto-git-release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 70a64c51a..fe4261447 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,19 +17,21 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: ${{ github.ref }} # Use current branch XXX You might want to use main or master + branch: ${{ env.GITHUB_REF_SLUG }} # Use current branch XXX You might want to use main or master tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change - format: "${major}.${minor}.${patch}-${{ github.ref }}.${increment}" # A string to determine the format of the version output + format: "${major}.${minor}.${patch}-${{ env.GITHUB_REF_SLUG }}.${increment}" # A string to determine the format of the version output - run: | - echo "Branch name: ${{ github.ref#refs/heads/ }}" + echo "Branch name: ${{ env.GITHUB_REF_SLUG }}" echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}} echo "Next version: ${{steps.next_semantic_version.outputs.version}}" echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}" @@ -38,7 +40,7 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{steps.next_semantic_version.outputs.version}} prerelease: true - title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`${{ github.ref }}`)" + title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`${{ env.GITHUB_REF_SLUG }}`)" files: | README.md CHANGELOG.md From e91ab5a4b65252079c7ff08abbe2989cc01e9b9a Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:33:00 +0100 Subject: [PATCH 18/23] Use fixed version --- .github/workflows/auto-git-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index fe4261447..91e00faff 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -3,6 +3,7 @@ # # See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v3.1.2 # See https://github.com/marvinpinto/action-automatic-releases https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0 +# See https://github.com/rlespinasse/github-slug-action https://github.com/rlespinasse/github-slug-action/tree/3.1.0 name: 'Auto release' on: @@ -18,7 +19,7 @@ jobs: runs-on: ubuntu-18.04 steps: - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v3.x + uses: rlespinasse/github-slug-action@v3.1.0 - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action From 2d92131c275c6e7b51d5f8e01e6108126d45a37d Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:35:35 +0100 Subject: [PATCH 19/23] Can't use fixed version, rollback --- .github/workflows/auto-git-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 91e00faff..8eb92c318 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -3,7 +3,7 @@ # # See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v3.1.2 # See https://github.com/marvinpinto/action-automatic-releases https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0 -# See https://github.com/rlespinasse/github-slug-action https://github.com/rlespinasse/github-slug-action/tree/3.1.0 +# See https://github.com/rlespinasse/github-slug-action https://github.com/rlespinasse/github-slug-action/tree/3.x name: 'Auto release' on: @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-18.04 steps: - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v3.1.0 + uses: rlespinasse/github-slug-action@v3.x - uses: actions/checkout@v2 with: fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action From 1d6ba056092e44c557c955167b2da29dab2803b6 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:36:48 +0100 Subject: [PATCH 20/23] Use version_tag (looks cleaner) --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 8eb92c318..8082419dc 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -39,7 +39,7 @@ jobs: - uses: marvinpinto/action-automatic-releases@10bdce64abdb4558a2ee6983192242be40d631d8 # Pin "latest" https://github.com/marvinpinto/action-automatic-releases/commit/10bdce64abdb4558a2ee6983192242be40d631d8 necessary to avoid "The `set-env` command is disabled." with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: ${{steps.next_semantic_version.outputs.version}} + automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}} prerelease: true title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`${{ env.GITHUB_REF_SLUG }}`)" files: | From 9e38f8558801eb471a08c8a2b1a73aeb25492087 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:38:43 +0100 Subject: [PATCH 21/23] Only trigger it on main branches --- .github/workflows/auto-git-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index 8082419dc..e9db7f2a6 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -12,7 +12,6 @@ on: # - main # - master - 'v2-*' # XXX NRN releases on v2 branches, but you'll likely want to release on either main or master - - '*' # For testing/debugging jobs: tag-and-release: From ae1a2a85d28cd0f78ddef4dfe319a1ef47032f08 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:40:42 +0100 Subject: [PATCH 22/23] Improve doc --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index e9db7f2a6..bbdfc0948 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -17,7 +17,7 @@ jobs: tag-and-release: runs-on: ubuntu-18.04 steps: - - name: Inject slug/short variables + - name: Expose GitHub slug/short variables # See https://github.com/rlespinasse/github-slug-action#exposed-github-environment-variables uses: rlespinasse/github-slug-action@v3.x - uses: actions/checkout@v2 with: From 869fc24143df71e70836ccf936f8e60b0b185d05 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Sat, 19 Dec 2020 02:42:08 +0100 Subject: [PATCH 23/23] Improve doc (2) --- .github/workflows/auto-git-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-git-release.yml b/.github/workflows/auto-git-release.yml index bbdfc0948..823809765 100644 --- a/.github/workflows/auto-git-release.yml +++ b/.github/workflows/auto-git-release.yml @@ -25,7 +25,7 @@ jobs: - uses: paulhatch/semantic-version@v3.1.2 id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69 with: # See https://github.com/PaulHatch/semantic-version#usage - branch: ${{ env.GITHUB_REF_SLUG }} # Use current branch XXX You might want to use main or master + branch: ${{ env.GITHUB_REF_SLUG }} # Use current branch tag_prefix: "v" # The prefix to use to identify tags major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change minor_pattern: "(MINOR)" # Same as above except indicating a minor change