From d563f56ab0b2fd2a4523c3f71ae88b427d5c29e8 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 17 Feb 2023 06:57:49 +0100 Subject: [PATCH] Cleanup zip-release [why] Some changes to bring it in line with the other workflows. [how] Sorted from short to long: * Name all steps * Correct trigger * Remove unused output * Simplify zipcmp decision * Use apt instead of apt-get * Update upload-artifact action * Remove some trailing whitespace * Remove name from artifact to prevent strange double zip name * Use ordinary checkout instead of sparse - we need it anyhow to commit [note] Ok, 'simplify zipcmd decision' that might be matter of taste. Signed-off-by: Fini Jastrow --- .github/workflows/zip-release.yml | 74 ++++++++++++++----------------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/.github/workflows/zip-release.yml b/.github/workflows/zip-release.yml index fa97ac15d..68c0ede54 100644 --- a/.github/workflows/zip-release.yml +++ b/.github/workflows/zip-release.yml @@ -1,60 +1,54 @@ -name: Create FontPatcher.zip from master +name: Create FontPatcher.zip on: - create: push: - #branches: master + branches: master paths: - font-patcher - src/glyphs/** - src/archive-font-patcher-readme.me - bin/scripts/archive-font-patcher.sh - - bin/scripts/name_parser - - .github/workflows/release_master_fontpatcher-zip.yaml + - bin/scripts/name_parser/Fontname*.py workflow_dispatch: - jobs: build: runs-on: ubuntu-latest - outputs: - changed: ${{ steps.updated-or-not.outputs.updated }} steps: - - name: install zipcmp - run: sudo apt-get install -y zipcmp - - name: Grab the script and its dependencies from the repo - uses: snow-actions/sparse-checkout@v1.2.0 - with: - patterns: | - FontPatcher.zip - font-patcher - src/glyphs - src/archive-font-patcher-readme.md - bin/scripts/archive-font-patcher.sh - bin/scripts/name_parser - - run: chmod +x - font-patcher - bin/scripts/archive-font-patcher.sh - bin/scripts/name_parser - - run: bin/scripts/archive-font-patcher.sh - - uses: actions/upload-artifact@v2 - with: - name: FontPatcher.zip - path: archives/FontPatcher.zip - - id: updated-or-not + - name: Checkout + uses: actions/checkout@v3 + + - name: Fetch dependencies + run: sudo apt install -y -q zipcmp + + - name: Create archive run: | - if zipcmp archives/FontPatcher.zip ./FontPatcher.zip ; then - echo "updated=false" | tee -a $GITHUB_OUTPUT - else - echo "updated=true" | tee -a $GITHUB_OUTPUT - fi - - run: cp archives/FontPatcher.zip . -f - - uses: EndBug/add-and-commit@v9 - if: steps.updated-or-not.outputs.updated == 'true' - #needs to be quoted + chmod u+x font-patcher bin/scripts/archive-font-patcher.sh + cd bin/scripts + ./archive-font-patcher.sh + + - name: Upload archive as artifact + uses: actions/upload-artifact@v3 + with: + path: archives/FontPatcher.zip + retention-days: 1 + + - name: Check if archive contents changed + id: updated-or-not + run: | + (zipcmp archives/FontPatcher.zip ./FontPatcher.zip; \ + echo "updated=$?" >> $GITHUB_OUTPUT) || true + + - name: Prepare commit + if: steps.updated-or-not.outputs.updated != 0 + run: cp -f archives/FontPatcher.zip . + + - name: Commit new archive + uses: EndBug/add-and-commit@v9 + if: steps.updated-or-not.outputs.updated != 0 with: fetch: false add: "FontPatcher.zip" - message: "[ci] update FontPatcher.zip" + message: "[ci] Update FontPatcher.zip" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com