Setup CI/CD workflow #7
Workflow file for this run
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: Dev Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
dev-release: | |
permissions: write-all | |
name: Dev Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22.8.0' | |
- name: Install dependencies | |
run: npm install | |
- name: Build source files | |
run: npm run build | |
- name: Prepare for build | |
run: npm run prepack | |
- name: Build tarballs | |
run: npm run pack | |
- name: Clean up build | |
run: npm run postpack | |
- name: Extract version | |
id: get_version | |
run: echo "::set-output name=VERSION::$(jq -r '.version' package.json)" | |
- name: Fetch commit info | |
id: get_git_info | |
run: | | |
git_hash=$(git rev-parse --short "$GITHUB_SHA") | |
git_branch=${GITHUB_REF#refs/heads/} | |
echo "::set-output name=GIT_HASH::$git_hash" | |
echo "::set-output name=GIT_BRANCH::$git_branch" | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: dev-${{ github.run_number }} | |
release_name: Dev Build on ${{ steps.get_git_info.outputs.GIT_BRANCH }} #${{ steps.get_git_info.outputs.GIT_HASH }} | |
draft: false | |
prerelease: true | |
- name: Find and upload release artifacts | |
run: | | |
for file in $(find ./dist -name "*.tar.gz"); do | |
echo "Uploading $file..." | |
gh release upload ${{ steps.create_release.outputs.tag_name }} $file --clobber | |
done |