Build and Draft Release #1174
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 Draft Release | |
# Only runs | |
# - after PRs have been merged into master | |
# - when a user specifically requests the workflow to run on a branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: master | |
jobs: | |
checkversion: | |
name: Check if version has corrosponding tag | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
commits: ${{ steps.commits.outputs.commits }} | |
template: ${{ steps.template.outputs.template }} | |
dobuild: ${{ steps.dobuild.outputs.dobuild }} | |
steps: | |
- name: Checkout crowbartools/firebot | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Read package.json | |
id: package | |
uses: gregoranders/[email protected] | |
- name: Retrieve package.json version | |
id: version | |
run: echo "version=${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT | |
- name: Get commit messages | |
id: commits | |
shell: bash | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
RES=$(git log --pretty=format:'- %s' --branches=origin/v5 $(git describe --tags `git rev-list --tags --max-count=1`)..HEAD) | |
echo "commits<<${EOF}" >> $GITHUB_OUTPUT | |
echo "${RES}" >> $GITHUB_OUTPUT | |
echo "${EOF}" >> $GITHUB_OUTPUT | |
- name: Read Release Template | |
id: template | |
shell: bash | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
TEMPLATE=`cat './.github/release-template.md'` | |
echo "template<<${EOF}" >> $GITHUB_OUTPUT | |
echo "${TEMPLATE}" >> $GITHUB_OUTPUT | |
echo "${EOF}" >> $GITHUB_OUTPUT | |
- name: 'Check: package version has corrosponding git tag' | |
id: dobuild | |
shell: bash | |
run: echo dobuild=$(git show-ref --tags --verify --quiet -- "refs/tags/v${{ steps.version.outputs.version }}" && echo 0 || echo 1) >> $GITHUB_OUTPUT | |
compile: | |
name: 'Compile' | |
needs: [checkversion] | |
if: needs.checkversion.outputs.dobuild == 1 | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.17.1' | |
- name: Install correct npm version | |
run: npm install -g [email protected] | |
- name: Linux Build Prep | |
if: runner.os == 'linux' | |
run: sudo apt-get install libx11-dev libxtst-dev libpng-dev | |
- name: MacOS Build Prep | |
if: runner.os == 'macOS' | |
# Force install this dep until node-appdmg then electron-installer-dmg gets updated | |
run: npm install github:SReject/electron-installer-dmg#9bdb5217b078c724918271549f34d362aecbf6bb | |
- name: Install Global Dependencies | |
run: npm install --global --production --omit=dev grunt-cli | |
- name: Install Project Dependencies | |
run: npm install | |
- name: Decrypt Secrets.gpg | |
env: | |
PASSKEY_FOR_FIREBOT_SECRETS: ${{ secrets.PASSKEY_FOR_FIREBOT_SECRETS }} | |
run: grunt secrets:decrypt | |
- name: Build for Platform | |
run: grunt build | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }} | |
path: ./dist/install/${{ runner.os == 'macOS' && 'darwin' || runner.os }}/ | |
draft: | |
name: Draft Github Release | |
needs: [checkversion, compile] | |
if: needs.checkversion.outputs.dobuild == 1 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Compilation Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./bundles/ | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
draft: true | |
prerelease: false | |
tag_name: v${{ needs.checkversion.outputs.version }} | |
name: Release v${{ needs.checkversion.outputs.version }} | |
body: ${{ format(needs.checkversion.outputs.template, needs.checkversion.outputs.version, needs.checkversion.outputs.commits) }} | |
generate_release_notes: false | |
files: | | |
./bundles/Windows/firebot-v${{ needs.checkversion.outputs.version }}-setup.exe | |
./bundles/Windows/firebot-${{ needs.checkversion.outputs.version }}-full.nupkg | |
./bundles/Windows/RELEASES | |
./bundles/Linux/firebot-v${{ needs.checkversion.outputs.version }}-linux-x64.tar.gz | |
./bundles/macOS/firebot-v${{ needs.checkversion.outputs.version }}-macos-x64.dmg |