Update network_text.py (#281) #201
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 release zip | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
compile_launcher: | |
uses: ./.github/workflows/_compile_launcher.yml | |
build-release-zip: | |
name: Build release zip | |
needs: compile_launcher | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # we want to collect tag info, so clone all history | |
- name: Download exe | |
uses: actions/download-artifact@v4 | |
with: | |
name: dqxclarity.exe | |
- name: Update GITHUB_ENV env | |
run: | | |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
echo "CURRENT_TAG=`git describe --always --tags $(git rev-list --tags) | grep -v 'dev' | grep -E '^v' | head -n1 | cut -d"-" -f1`" >> $GITHUB_ENV | |
echo "NEW_TAG=`echo ${GITHUB_REF} | cut -d"/" -f3`" >> $GITHUB_ENV | |
- name: Bump version.update | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo $GITHUB_REF | cut -d"v" -f2 > version.update | |
- name: Build package | |
run: | | |
rsync -av --exclude="imgs/" --exclude="launcher/" --exclude="tests/" app/* dqxclarity/; | |
cp version.update requirements.txt user_settings.ini dqxclarity.exe dqxclarity/; | |
cp clarity_dialog.db dqxclarity/misc_files; | |
- name: Zip package (pre-release) | |
if: startsWith(github.ref, 'refs/tags/v') != true | |
run: zip -r dqxclarity-dev-$SHORT_SHA.zip dqxclarity | |
- name: Zip package (release) | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: zip -r dqxclarity.zip dqxclarity | |
- name: Cleanup existing assets from dev release | |
if: startsWith(github.ref, 'refs/tags/v') != true | |
uses: mknejp/delete-release-assets@v1 | |
continue-on-error: true # tag or assets may not exist | |
with: | |
token: ${{ github.token }} | |
tag: ${{ env.CURRENT_TAG }}-dev | |
assets: '*.zip' | |
- name: Create dev release | |
if: startsWith(github.ref, 'refs/tags/v') != true | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dqxclarity-dev-${{ env.SHORT_SHA }}.zip | |
prerelease: true | |
tag_name: ${{ env.CURRENT_TAG }}-dev | |
name: 'Dev Build: ${{ env.CURRENT_TAG }}-dev' | |
body: "This is a pre-release build! You don't want to download this!" | |
- name: Commit version.update to main | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: auto-commit-action | |
with: | |
commit_message: 'Automated bump of version.update' | |
file_pattern: 'version.update' | |
branch: main | |
env: | |
GITHUB_TOKEN: ${{ secrets.SVC_ACCT_PAT }} | |
# probably a better way to do this. big no-no to move an existing tag, | |
# but there's no malicious stuff going on here. we just want the tag | |
# to include the updated version.update file and we're doing it strictly | |
# in CI. the tag is what triggers these steps and I don't want to manually | |
# update the version.update file before pushing the tag. | |
- name: Include previous commit in new tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
git checkout ${{ steps.auto-commit-action.outputs.commit_hash }} | |
git tag -f $NEW_TAG | |
git push --force origin $NEW_TAG | |
env: | |
GITHUB_TOKEN: ${{ secrets.SVC_ACCT_PAT }} | |
- name: Download previous release's dat/idx files | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: robinraju/[email protected] | |
with: | |
latest: true | |
fileName: "data00000000*" | |
- name: Create prod release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dqxclarity.zip | |
data00000000.win32.dat1 | |
data00000000.win32.idx | |
prerelease: false | |
draft: false | |
tag_name: ${{ github.ref }} | |
name: 'Release: ${{ env.NEW_TAG }}' # github.ref does not trim refs/tags/ when used here | |
generate_release_notes: true | |
fail_on_unmatched_files: true |