add automation for FH item 258 #680
Workflow file for this run
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: Build and publish release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*" | |
- "!v*-*" | |
jobs: | |
create_release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
release_zip: | |
name: Release zip | |
needs: create_release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: npm install and npm run build | |
run: | | |
npm i | |
npm run build | |
- name: Create Zip | |
uses: thedoctor0/zip-release@main | |
with: | |
type: "zip" | |
directory: "dist/gloomhavensecretariat" | |
filename: "gloomhavensecretariat-${{github.ref_name}}.zip" | |
- name: Upload release zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./dist/gloomhavensecretariat/gloomhavensecretariat-${{github.ref_name}}.zip | |
asset_name: gloomhavensecretariat-${{github.ref_name}}.zip | |
asset_content_type: application/octet-stream | |
release_electron: | |
name: Release electron builds | |
needs: create_release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [20.x] | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: npm install and npm run electron:build | |
run: | | |
npm i | |
npm run electron:build | |
env: | |
GH_TOKEN: ${{ secrets.TOKEN }} | |
publish: | |
name: Publish Draft Release | |
needs: [create_release, release_zip, release_electron] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
release_id: ${{ needs.create_release.outputs.release_id }} |