Skip to content

Publish v2.17.0

Publish v2.17.0 #174

Workflow file for this run

---
name: Publish
run-name: Publish ${{ github.ref_name }}
on:
push:
tags:
- v*
jobs:
build:
name: Build
uses: ./.github/workflows/_build.yml
release:
name: GitHub Releases
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: .
- name: Generate release notes
id: changelog
run: |
mkdir tmp
outfile=tmp/changelog.txt
echo "outfile=${outfile}" >> $GITHUB_OUTPUT
npx standard-changelog@^2.0.0 --release-count 2 --infile $outfile.tmp --outfile $outfile.tmp
sed '1,3d' $outfile.tmp > $outfile
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_TOKEN }}
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref_name, '-') }}
files: '*.tgz'
body_path: ${{ github.workspace }}/${{ steps.changelog.outputs.outfile }}
npm:
name: npm
uses: ./.github/workflows/_publish.yml
needs: build
with:
artifact_name: ${{ needs.build.outputs.artifact_name }}
registry_url: https://registry.npmjs.org
secrets:
registry_token: ${{ secrets.NPM_TOKEN }}
github:
name: GitHub Packages
uses: ./.github/workflows/_publish.yml
permissions:
contents: read
packages: write
needs: build
with:
artifact_name: ${{ needs.build.outputs.artifact_name }}
registry_url: https://npm.pkg.github.com
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
assets:
name: Assets
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- name: Get version
uses: actions/github-script@v7
id: version
with:
result-encoding: string
script: return context.ref.split('/')[2].slice(1)
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: .
- name: Extract package
run: tar -xzf *.tgz
- name: Sync to R2
uses: jakejarvis/s3-sync-action@v0.5.1
env:
AWS_S3_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ vars.CLOUDFLARE_R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.CLOUDFLARE_R2_BUCKET_REGION }}
AWS_S3_ENDPOINT: https://${{ vars.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
SOURCE_DIR: package
DEST_DIR: v/${{ steps.version.outputs.result }}