From 760d84e60daf533dc7634427f964ab252f3c79d5 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 10:56:56 -0700 Subject: [PATCH 1/8] ci(release): bump versions to the latest release --- .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b39497b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: release + +on: + workflow_dispatch: + inputs: + version: + default: "0.0.1" + description: "Version of the release" + required: true + type: string + +jobs: + release: + runs-on: ubuntu-latest + env: + VERSION: ${{ inputs.version }} + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: configure git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + - name: bump versions + run: | + DATE=$(date +"%B %d %Y") + MANPAGE=".TH wd \"1\" \"$DATE\" \"wd $VERSION\" \"wd Manual\"" + sed -i -E "1 s/.*/$MANPAGE/" wd.1 + sed -i -E "s/WD_VERSION=.*/WD_VERSION=$VERSION/" wd.sh + - name: commit changes + run: | + git add wd.1 wd.sh + git commit -m "chore(update): bump current version to v$VERSION" + git tag v$VERSION + git push -u origin master --tags + - name: release latest + run: | + gh release create v$VERSION --generate-notes + env: + GH_TOKEN: ${{ github.token }} From 36dc32613a3b48e277dd8a0155bcb5dc6f054527 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 16:27:40 -0700 Subject: [PATCH 2/8] fix: remove default version from dispatch input --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b39497b..e04e770 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,6 @@ on: workflow_dispatch: inputs: version: - default: "0.0.1" description: "Version of the release" required: true type: string From dc29ab9719fda28ee6f2dee0449943a44b04488a Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 16:30:52 -0700 Subject: [PATCH 3/8] feat: remove leading 'v' prefix from dispatch inputs --- .github/workflows/release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e04e770..45c9ddd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,6 @@ on: jobs: release: runs-on: ubuntu-latest - env: - VERSION: ${{ inputs.version }} steps: - name: checkout code uses: actions/checkout@v4 @@ -22,6 +20,11 @@ jobs: run: | git config --global user.name 'github-actions[bot]' git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + - name: parse input + run: | + VERSION=$(echo "${{ inputs.version }}" | sed -E "s/^v//g") + echo $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: bump versions run: | DATE=$(date +"%B %d %Y") From ac8cddbd27ba064a5d59a61d91374190bb0ac670 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 17:05:30 -0700 Subject: [PATCH 4/8] fix: remove extended git history on checkout --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45c9ddd..20a05c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,6 @@ jobs: steps: - name: checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: configure git run: | git config --global user.name 'github-actions[bot]' From 3f886ddeb4459921f30ece15310fa26c0dae62e1 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 17:59:31 -0700 Subject: [PATCH 5/8] fix: surround expanded version variables with quotes --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20a05c3..9a2eccf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,10 +33,10 @@ jobs: run: | git add wd.1 wd.sh git commit -m "chore(update): bump current version to v$VERSION" - git tag v$VERSION + git tag "v$VERSION" git push -u origin master --tags - name: release latest run: | - gh release create v$VERSION --generate-notes + gh release create "v$VERSION" --generate-notes env: GH_TOKEN: ${{ github.token }} From 2cf3ec9c47d43a6e83af2bee074131ba382ec4d2 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 17:45:15 -0700 Subject: [PATCH 6/8] feat: use the preferred github token secret variable --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a2eccf..3b042d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,4 +39,4 @@ jobs: run: | gh release create "v$VERSION" --generate-notes env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9ae8ea40b1613fa1ea6cce4f857633bbd2ee286b Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 18:17:30 -0700 Subject: [PATCH 7/8] feat: save the date in an unambiguous variable --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b042d0..468ac1c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,10 @@ jobs: VERSION=$(echo "${{ inputs.version }}" | sed -E "s/^v//g") echo $VERSION echo "VERSION=$VERSION" >> $GITHUB_ENV + DATE=$(date +"%Y-%m-%d") + echo "DATE=$DATE" >> $GITHUB_ENV - name: bump versions run: | - DATE=$(date +"%B %d %Y") MANPAGE=".TH wd \"1\" \"$DATE\" \"wd $VERSION\" \"wd Manual\"" sed -i -E "1 s/.*/$MANPAGE/" wd.1 sed -i -E "s/WD_VERSION=.*/WD_VERSION=$VERSION/" wd.sh From 3c1e2aca38df5ae35b1991c8af5f5c50d0636fc8 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 16 Jun 2024 18:18:27 -0700 Subject: [PATCH 8/8] docs: include example values of input variables --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 468ac1c..c996350 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,10 +20,9 @@ jobs: git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - name: parse input run: | - VERSION=$(echo "${{ inputs.version }}" | sed -E "s/^v//g") - echo $VERSION + VERSION=$(echo "${{ inputs.version }}" | sed -E "s/^v//g") # Ex: 1.2.3 echo "VERSION=$VERSION" >> $GITHUB_ENV - DATE=$(date +"%Y-%m-%d") + DATE=$(date +"%Y-%m-%d") # Ex: 2022-02-22 echo "DATE=$DATE" >> $GITHUB_ENV - name: bump versions run: |