Skip to content

ci(build): fix builds repo ref #50

ci(build): fix builds repo ref

ci(build): fix builds repo ref #50

Workflow file for this run

name: Build
on:
push:
tags:
- "v*"
jobs:
build:
name: Build and release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout builds
uses: actions/checkout@v4
with:
repository: "revenge-mod/ci-builds"
path: "builds"
token: ${{ secrets.BUILDS_PUSH_TOKEN }}
# TODO: fix this
ref: main
- name: Set env
id: env
run: |
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "hash=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm and dependencies
run: |
npm i -g pnpm
pnpm i
- name: Build
run: pnpm build --release-branch=${{ github.ref_name }} --build-minify
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.env.outputs.tag }}
release_name: Revenge ${{ steps.env.outputs.tag }}
draft: true
prerelease: false
- name: Upload dist
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/revenge.js
asset_name: revenge.js
asset_content_type: text/javascript
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
- name: Push build
run: |
rm $GITHUB_WORKSPACE/builds/* || true
cp -r dist/* $GITHUB_WORKSPACE/builds || true
cd $GITHUB_WORKSPACE/builds
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Build $GITHUB_SHA" || exit 0
git push
env:
GITHUB_TOKEN: ${{ secrets.BUILDS_PUSH_TOKEN }}