Merge pull request #44 from TheBrutalX/codeql #33
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: Release | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
env: | |
BOT_APPID: 1044190 | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
build: | |
runs-on: ubuntu-latest | |
needs: [ tests ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ env.BOT_APPID }} | |
private-key: ${{ secrets.BOT_TOKEN }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Commit bundle.js | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" | |
git add -f dist | |
git add package*.json | |
git commit -m 'chore(release): Added bundle.js [skip ci]' | |
git push origin main | |
release: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get version | |
id: version | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
echo "Version: $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ env.BOT_APPID }} | |
private-key: ${{ secrets.BOT_TOKEN }} | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
VERSION: ${{ steps.version.outputs.VERSION }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" | |
git tag "Release ${VERSION}" -m "Release ${VERSION}" | |
git push origin "Release ${VERSION}" | |
- name: Move latest tag | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
git tag -f latest | |
git push origin latest --force |