1+ name : build
2+ on :
3+ workflow_dispatch :
4+ push :
5+ branches :
6+ - master
7+ paths :
8+ - " package.json"
9+ pull_request :
10+ branches :
11+ - master
12+ paths :
13+ - " package.json"
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v3
20+ with :
21+ ref : " main"
22+ - name : Set up Node.js
23+ uses : actions/setup-node@v3
24+ with :
25+ node-version : " 20"
26+ - name : Install dependencies
27+ run : |
28+ npm install -g pnpm
29+ pnpm i --no-frozen-lockfile
30+ - name : Bundle
31+ run : |
32+ pnpm build
33+ - id : tag
34+ name : Generate release tag
35+ run : |
36+ SUBSTORE_RELEASE=`node --eval="process.stdout.write(require('./package.json').version)"`
37+ echo "release_tag=$SUBSTORE_RELEASE" >> $GITHUB_OUTPUT
38+ - name : Prepare release
39+ run : |
40+ pnpm i -D conventional-changelog-cli
41+ npx conventional-changelog -p cli -i CHANGELOG.md -s
42+ - name : Release
43+ uses : softprops/action-gh-release@v1
44+ if : ${{ success() }}
45+ env :
46+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47+ with :
48+ body_path : ./CHANGELOG.md
49+ tag_name : ${{ steps.tag.outputs.release_tag }}
50+ # generate_release_notes: true
51+ files : |
52+ ./dist/_worker.js
53+ - name : Git push assets to "release" branch
54+ run : |
55+ cd dist || exit 1
56+ git init
57+ git config --local user.name "github-actions[bot]"
58+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
59+ git checkout -b release
60+ git add .
61+ git commit -m "release: ${{ steps.tag.outputs.release_tag }}"
62+ git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
63+ git push -f -u origin release
64+ # - name: Sync to GitLab
65+ # env:
66+ # GITLAB_PIPELINE_TOKEN: ${{ secrets.GITLAB_PIPELINE_TOKEN }}
67+ # run: |
68+ # curl -X POST --fail -F token=$GITLAB_PIPELINE_TOKEN -F ref=master https://gitlab.com/api/v4/projects/48891296/trigger/pipeline
0 commit comments