Check for Affinity updates #52
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: Check for Affinity updates | |
on: | |
schedule: | |
- cron: 0 0 * * * # daily | |
workflow_dispatch: | |
jobs: | |
get-current-version: | |
runs-on: ubuntu-latest | |
outputs: | |
current-version: ${{ steps.get-version.outputs.current-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- id: get-version | |
run: | | |
echo "current-version=$(nix eval --impure --json --expr 'let nixpkgs = import <nixpkgs> {}; source = nixpkgs.callPackage ./source.nix {}; in source._version')" >> $GITHUB_OUTPUT | |
get-live-version: | |
runs-on: ubuntu-latest | |
outputs: | |
live-version: ${{ steps.get-version.outputs.live-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: npm ci | |
working-directory: ./grab | |
- name: Install Playwright Browsers | |
working-directory: ./grab | |
run: npx playwright install --with-deps | |
- id: get-version | |
working-directory: ./grab | |
run: | | |
echo "live-version=$(npx ts-node grab.ts version)" >> $GITHUB_OUTPUT | |
grab-newest: | |
runs-on: ubuntu-latest | |
needs: | |
- get-live-version | |
- get-current-version | |
if: ${{ needs.get-live-version.outputs.live-version != needs.get-current-version.outputs.current-version }} | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: sudo apt install -y wget2 | |
- run: mkdir -p grab/out | |
- run: npm ci | |
working-directory: ./grab | |
- name: Install Playwright Browsers | |
working-directory: ./grab | |
run: npx playwright install --with-deps | |
- id: download-photo | |
working-directory: ./grab/out | |
run: | | |
wget2 --cut-file-get-vars $(npx ts-node ../grab.ts photo) | |
- id: download-designer | |
working-directory: ./grab/out | |
run: | | |
wget2 --cut-file-get-vars $(npx ts-node ../grab.ts designer) | |
- id: download-publisher | |
working-directory: ./grab/out | |
run: | | |
wget2 --cut-file-get-vars $(npx ts-node ../grab.ts publisher) | |
- id: hash-photo | |
working-directory: ./grab/out | |
run: | | |
echo "photo-hash=$(nix-hash --type sha256 ./affinity-photo-msi-*.exe)" >> $GITHUB_OUTPUT | |
- id: hash-designer | |
working-directory: ./grab/out | |
run: | | |
echo "designer-hash=$(nix-hash --type sha256 ./affinity-designer-msi-*.exe)" >> $GITHUB_OUTPUT | |
- id: hash-publisher | |
working-directory: ./grab/out | |
run: | | |
echo "publisher-hash=$(nix-hash --type sha256 ./affinity-publisher-msi-*.exe)" >> $GITHUB_OUTPUT | |
- name: Create Issue | |
run: | | |
new_issue_url=$(gh issue create \ | |
--title "bump suite version ${{needs.get-current-version.current-version}} > ${{needs.get-live-version}}" \ | |
--assignee "mrshmllow" \ | |
--label "update" \ | |
--body "$BODY") | |
env: | |
BODY: | | |
## new hashes | |
photo `${{ steps.hash-photo.outputs.photo-hash}}` | |
designer `${{ steps.hash-designer.outputs.designer-hash}}` | |
publisher `${{ steps.hash-designer.outputs.publisher-hash}}` | |