Merge pull request #12 from gurrrrrrett3/main #68
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: 'Deploy' | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Determine Version | |
run: | | |
pushd .github/workflows/scripts | |
npm ci | |
popd | |
VERSION=$(node .github/workflows/scripts/determineVersion) | |
echo "Next Version: $VERSION" | |
echo "OGB_VERSION=$VERSION" >> $GITHUB_ENV | |
echo "OGB_TAGNAME=release/$VERSION" >> $GITHUB_ENV | |
- name: Push tag | |
run: | | |
git config user.name Releases | |
git config user.email [email protected] | |
git diff --quiet || git commit -am "Release $VERSION" | |
git tag "$OGB_TAGNAME" | |
git push origin "$OGB_TAGNAME" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: packageJson | |
path: package.json | |
outputs: | |
version: ${{ env.OGB_VERSION }} | |
tagName: ${{ env.OGB_TAGNAME }} | |
build_win: | |
needs: [version] | |
runs-on: ubuntu-latest | |
container: | |
image: electronuserland/builder:wine | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: packageJson | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Build | |
run: | | |
npm ci --platform=win32 | |
(cd src/main && npx webpack) | |
(cd src/frontend && npx webpack) | |
npx electron-builder --win | |
env: | |
HOME: /root | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows | |
path: dist/OscGoesBrrr-setup.exe | |
release: | |
needs: [version, build_win] | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
path: repo | |
- name: Checkout version manifest | |
uses: actions/checkout@v3 | |
with: | |
path: versions | |
repository: OSCToys/ogb-updater-manifest | |
ssh-key: ${{ secrets.VERSION_DEPLOY_KEY }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows | |
path: windows | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.version.outputs.tagName }} | |
name: Release ${{ needs.version.outputs.version }} | |
files: | | |
windows/OscGoesBrrr-setup.exe | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Update Version Manifest | |
run: | | |
pushd repo/.github/workflows/scripts | |
npm ci | |
popd | |
pushd versions | |
node ../repo/.github/workflows/scripts/updateManifest "$VERSION" "$DOWNLOAD_URL" | |
popd | |
env: | |
VERSION: ${{ needs.version.outputs.version }} | |
DOWNLOAD_URL: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }} | |
- name: Push version manifest | |
working-directory: versions | |
run: | | |
git diff | |
git config user.name Releases | |
git config user.email [email protected] | |
git diff --quiet || git commit -am "Release from $GITHUB_SHA" | |
git push |