Merge pull request #19 from ainoya/fix-manifest-json-format #16
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: tagpr | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
tagpr: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tagpr.outputs.tag }} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: 1053852 | |
private-key: ${{ secrets.AINOYA_BOT_PRIVATE_KEY }} | |
- name: increment chrome extnsion manifest.json version | |
run: | | |
CURRENT_VERSION=$(jq -r '.version' public/manifest.json) | |
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{if (NF==1) {$1+=1} else {$NF+=1}; OFS="."; print $0}' | sed 's/ /./g') | |
jq --arg new_version $NEW_VERSION '.version = $new_version' public/manifest.json > public/manifest.json.tmp | |
mv public/manifest.json.tmp public/manifest.json | |
- name: biome check fix | |
run: npm run check -- --fix | |
- uses: Songmu/tagpr@v1 | |
id: tagpr | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
# run job to upload artifact if git tagged | |
upload: | |
runs-on: ubuntu-latest | |
needs: tagpr | |
if: needs.tagpr.outputs.tag != '' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: | | |
npm run build | |
zip -r dist.zip dist | |
- name: Upload artifact | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.tagpr.outputs.tag }} | |
files: | | |
dist.zip |