Merge pull request #24 from vemonet/fix-fetch-get #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all history for all tags and branches, so that Changesets can determine the version bump | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: npm | |
- name: Install Dependencies | |
run: npm ci | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: npm run release | |
commit: "chore: release" | |
title: "Merge to release" | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add build archives to new release | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
# Create an archive for the `build` directory (zip and tar.gz formats) | |
zip -r build.zip build | |
tar -czvf build.tar.gz build | |
# Upload the archive to all published packages | |
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[]|[.name, .version] | @tsv' | | |
while IFS=$'\t' read -r name version; do | |
tag="$name@$version" | |
# Upload the archives to the release | |
gh release upload $tag build.zip --clobber | |
gh release upload $tag build.tar.gz --clobber | |
done | |
# Clean up the archive files | |
rm build.zip build.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} |