Create new release when merging into main #1
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: Create release | |
on: | |
pull_request_target: | |
branches: | |
- main | |
types: | |
- closed | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
release: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install autotag binary | |
run: curl -sL https://git.io/autotag-install | sudo sh -s -- -b /usr/bin | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run webpack | |
- name: create release | |
run: |- | |
TAG=$(autotag) | |
git tag $TAG | |
git push origin $TAG | |
gh release create $TAG './webpack/dist/main.js#main.js' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |