Release 2.0.0 #7
Workflow file for this run
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: Update flatpak manifest | |
on: | |
push: | |
tags: v* | |
permissions: read-all | |
jobs: | |
# Re-generate cargo-sources.json whenever we push a release. | |
# We use a separate job here because we need to setup Python and clone the | |
# whole builder tools repo. | |
update-cargo-sources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: flatpak/flatpak-builder-tools | |
path: flatpak-builder-tools | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- run: pipx install poetry | |
- run: poetry install | |
working-directory: flatpak-builder-tools/cargo | |
- run: poetry run python ./flatpak-cargo-generator.py "${GITHUB_WORKSPACE}/Cargo.lock" -o "${GITHUB_WORKSPACE}/flatpak/cargo-sources.json" | |
working-directory: flatpak-builder-tools/cargo | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cargo-sources | |
path: flatpak/cargo-sources.json | |
# When pushing a tag also make a pull request to update the flatpak manifest | |
# to refer to the new release. | |
update-manifest: | |
runs-on: ubuntu-latest | |
# We also want updated cargo-sources.json | |
needs: update-cargo-sources | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Download the cargo-sources.json manifest and move it to the right place. | |
- uses: actions/download-artifact@v4 | |
with: | |
name: cargo-sources | |
- run: mv cargo-sources.json flatpak/cargo-sources.json | |
# Get the SHA512 checksum for the git sources archive of the tag | |
- run: echo ARCHIVE_SHA512="$(curl -L https://github.com/swsnr/turnon/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz | sha512sum | cut -d' ' -f1)" >> "$GITHUB_ENV" | |
# Replace the actual sources for turnon with appropriate environment variables... | |
- name: Replace sha512sum | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq eval -i '.modules.[0].sources.[0].url = "https://github.com/swsnr/turnon/archive/refs/tags/$GITHUB_REF_NAME.tar.gz"' flatpak/de.swsnr.turnon.yaml | |
- name: Replace sha512sum | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq eval -i '.modules.[0].sources.[0].sha512 = "$ARCHIVE_SHA512"' flatpak/de.swsnr.turnon.yaml | |
# ...and then substitute the environment variables to get the actual URL and checksum into the manifest | |
- name: Substitute environment variables | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq eval -i '(.. | select(tag == "!!str")) |= envsubst' flatpak/de.swsnr.turnon.yaml | |
# A little sanity check | |
- run: git diff | |
# Create a pull request to update the manifest on main | |
- uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: "Update flatpak manifest for ${{ github.ref_name }}" | |
branch: workflow/update-flatpak-manifest | |
base: main | |
sign-commits: true | |
delete-branch: true | |
title: "Update flatpak manifest for ${{ github.ref_name }}" | |
body: "Automated update of flatpak manifest for release ${{ github.ref_name }}" | |
assignees: swsnr | |
draft: always-true |