Update Scoop #512
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 Scoop | |
on: | |
workflow_run: | |
workflows: ["Release naisdevice"] | |
types: | |
- completed | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
update-scoop: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Latest version | |
id: latest_version | |
uses: abatilo/release-info-action@5774bec4e3eabad433b4ae8f625e83afa0e7bb22 | |
with: | |
owner: nais | |
repo: device | |
- uses: navikt/github-app-token-generator@v1 | |
id: get-scoop-token | |
with: | |
private-key: ${{ secrets.NAIS_APP_PRIVATE_KEY }} | |
app-id: ${{ secrets.NAIS_APP_ID }} | |
repo: nais/scoop-bucket | |
- name: Checkout scoop-bucket | |
uses: actions/checkout@v4 | |
with: | |
repository: nais/scoop-bucket | |
token: ${{ steps.get-scoop-token.outputs.token }} | |
path: bucket | |
- name: Update version and checksum in manifest | |
id: update_manifest | |
env: | |
LATEST: ${{ steps.latest_version.outputs.latest_tag }} | |
LATEST_DATE: ${{ steps.latest_version.outputs.latest_tag_published_at }} | |
SCOOP_TOKEN: ${{ steps.get-scoop-token.outputs.token }} | |
run: | | |
echo "Version ${LATEST} was released at ${LATEST_DATE}" | |
if [[ "${LATEST}" == "null" ]]; then | |
echo "Invalid version!" | |
exit 1 | |
fi | |
cd bucket | |
git config user.email "[email protected]" | |
git config user.name "naisdevice pipeline" | |
for exe in naisdevice naisdevice-tenant ; do | |
url=https://github.com/nais/device/releases/download/${LATEST}/${exe}.exe | |
update_url=https://github.com/nais/device/releases/download/\$version/${exe}.exe | |
checksum=$(curl --location ${url}.sha256) | |
jq ".architecture[\"64bit\"].url = \"${url}\" | .architecture[\"64bit\"].hash = \"${checksum}\" | .version = \"${LATEST}\" | .autoupdate[\"64bit\"].url = \"${update_url}\"" ../packaging/windows/scoop-template.json > ${exe}.json | |
done | |
git add naisdevice*.json | |
if ! git --no-pager diff --cached --exit-code; then | |
git commit -a -m "Bump naisdevice version to ${LATEST}" | |
git push | |
fi |