Merge pull request #37 from satoryu/dependabot/npm_and_yarn/babel/pre… #99
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
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
name: Build a package | |
runs-on: ubuntu-latest | |
environment: release | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract version from manifest.json | |
id: manifest_version | |
uses: sergeysova/jq-action@v2 | |
with: | |
cmd: jq -r .version package.json | |
- name: Define package name | |
id: package_name | |
run: echo 'package_name=copy-for-scrapbox-${{steps.manifest_version.outputs.value}}' >> $GITHUB_OUTPUT | |
- run: npm install | |
- name: Build | |
run: npm run build | |
env: | |
VITE_GA_ENDPOINT: ${{ secrets.VITE_GA_ENDPOINT }} | |
VITE_MEASUREMENT_ID: ${{ secrets.VITE_MEASUREMENT_ID }} | |
VITE_API_SECRET: ${{ secrets.VITE_API_SECRET }} | |
- name: Packaging | |
run: | | |
mkdir packages | |
cd dist | |
zip -r ../packages/${{steps.package_name.outputs.package_name}}.zip ./ \ | |
-x '*.git*' \ | |
-x '*.md' \ | |
-x 'LICENSE' \ | |
-x '*packages/*' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{steps.package_name.outputs.package_name}}.zip | |
path: packages/${{steps.package_name.outputs.package_name}}.zip | |
- uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') # Run only when tagged like v1.0.1 | |
with: | |
files: packages/${{steps.package_name.outputs.package_name}}.zip | |
generate_release_notes: true |