From 15256a5701e8486edf240b29e4ed2bae0881f42b Mon Sep 17 00:00:00 2001 From: Daniel McCormack <52194107+demccormack@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:18:27 +1300 Subject: [PATCH 1/4] Use latest actions versions --- src/templates/build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/templates/build.yml b/src/templates/build.yml index 568dd85..4472d62 100644 --- a/src/templates/build.yml +++ b/src/templates/build.yml @@ -4,7 +4,6 @@ on: push: branches: [main] pull_request: - branches: [main] jobs: build: @@ -12,22 +11,22 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup LaTeX - uses: xu-cheng/latex-action@v3 + uses: xu-cheng/latex-action@v4 with: root_file: main.tex - name: Upload PDF - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ github.event.repository.name }}-pdf path: main.pdf - name: Create Release (on tag) if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: main.pdf env: From 8b6ad96f97f9e6ca8099012d963983532b1796a4 Mon Sep 17 00:00:00 2001 From: Daniel McCormack <52194107+demccormack@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:22:21 +1300 Subject: [PATCH 2/4] WIP workflows for publishing --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++ .github/workflows/tag-release.yml | 55 +++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tag-release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b79fc15 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + publish-npm: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + cache: 'npm' + registry-url: 'https://registry.npmjs.org/' + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Publish to NPM + run: | + echo "Publishing to NPM..." + npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + announce-patreon: + runs-on: ubuntu-latest + needs: publish-npm + + steps: + - name: Extract version from tag + id: version + run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Post to Patreon + run: | + curl -X POST "https://www.patreon.com/api/oauth2/v2/posts" \ + -H "Authorization: Bearer ${{ secrets.PATREON_ACCESS_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d @- << 'EOF' + { + "data": { + "type": "post", + "attributes": { + "title": "📦 Write CLI v${{ steps.version.outputs.version }} Released!", + "content": "A new version of the Write CLI tool has been released! 🎉\n\n**Version:** ${{ steps.version.outputs.version }}\n**Release Notes:** ${{ github.event.release.html_url }}\n**NPM Package:** https://www.npmjs.com/package/@demccormack/write\n\nInstall with: `npm install -g @demccormack/write`\n\nThank you for your support! ❤️", + "is_paid": false, + "post_type": "text_only" + } + } + } + EOF diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml new file mode 100644 index 0000000..4764fa8 --- /dev/null +++ b/.github/workflows/tag-release.yml @@ -0,0 +1,55 @@ +name: Tag Release + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +jobs: + create-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Create NPM package tarball + run: npm pack + + - name: Create release assets archive + run: | + mkdir -p release-assets + cp -r dist release-assets/ + cp *.tgz release-assets/ + tar -czf release-assets.tar.gz -C release-assets . + + - name: Extract version from tag + id: version + run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + draft: true + generate_release_notes: true + fail_on_unmatched_files: true + files: | + *.tgz + release-assets.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 99f482a6f0dcb3db06bc00edd1cac3ec65768776 Mon Sep 17 00:00:00 2001 From: Daniel McCormack <52194107+demccormack@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:30:11 +1300 Subject: [PATCH 3/4] Show version in logs --- .github/workflows/tag-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 4764fa8..bea7933 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -38,7 +38,7 @@ jobs: - name: Extract version from tag id: version - run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + run: echo "version=${GITHUB_REF#refs/tags/v}" | tee -a $GITHUB_OUTPUT - name: Create GitHub Release uses: softprops/action-gh-release@v2 From bd55defd7fe90618f492ef3a2410cf1a79d9b6c0 Mon Sep 17 00:00:00 2001 From: Daniel McCormack <52194107+demccormack@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:32:30 +1300 Subject: [PATCH 4/4] Add permissions --- .github/workflows/release.yml | 4 ++++ .github/workflows/tag-release.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b79fc15..d10569c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,8 @@ on: jobs: publish-npm: runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout code @@ -36,6 +38,8 @@ jobs: announce-patreon: runs-on: ubuntu-latest needs: publish-npm + permissions: + contents: read steps: - name: Extract version from tag diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index bea7933..b7264d1 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -9,6 +9,9 @@ on: jobs: create-release: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read steps: - name: Checkout code