Workflow file for this run
This file contains hidden or 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-install-zip-file (on release) | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
id-token: write | |
attestations: write | |
jobs: | |
build: | |
runs-on: [self-hosted, Windows, Office] | |
steps: | |
- name: "Checkout code for release tag" | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: "Build add-in" | |
id: build_add_in | |
uses: AccessCodeLib/msaccess-vcs-build@main | |
with: | |
source-dir: "source" | |
target-dir: "bin" | |
file-name: "ACLibDeclarationDictCore.accda" | |
run-accunit-tests: true | |
timeout-minutes: 10 | |
- name: "Build DeclDictTester" | |
id: build_delc_dict_tester | |
uses: AccessCodeLib/msaccess-vcs-build@main | |
with: | |
source-dir: "DeclDictTester.accdb.src" | |
target-dir: "bin" | |
file-name: "DeclDictTester.accdb" | |
run-accunit-tests: true | |
timeout-minutes: 10 | |
- name: "Build Example_APIusage" | |
id: build_example_api_usage | |
uses: AccessCodeLib/msaccess-vcs-build@main | |
with: | |
source-dir: "Example_APIusage.accdb.src" | |
target-dir: "bin" | |
file-name: "Example_APIusage.accdb" | |
timeout-minutes: 10 | |
- name: "Create versioned ZIP file" | |
run: | | |
$zipName = "ACLibImportWizard_${{ github.event.release.tag_name }}.zip" | |
Compress-Archive -Path .\bin\*.accda, .\bin\Example_APIusage.accdb -DestinationPath $zipName | |
echo "ZIP_NAME=$zipName" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: "Upload ZIP to GitHub Release" | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.ZIP_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Calculate SHA256 of ZIP" | |
id: hash | |
shell: pwsh | |
run: | | |
$zipName = "${{ env.ZIP_NAME }}" | |
$hash = Get-FileHash -Algorithm SHA256 -Path $zipName | |
$digest = "sha256:$($hash.Hash.ToLower())" | |
echo "ZIP_DIGEST=$digest" | Out-File -FilePath $env:GITHUB_ENV -Append | |
echo "digest=$digest" >> $env:GITHUB_OUTPUT | |
- name: "Attestation" | |
uses: actions/attest-build-provenance@v2 | |
id: attestation | |
with: | |
subject-name: "${{ env.ZIP_NAME }}" | |
subject-digest: "${{ steps.hash.outputs.digest }}" | |
- name: "Update release description with attestation URL" | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: ${{ github.repository }} | |
TAG: ${{ github.event.release.tag_name }} | |
run: | | |
$ErrorActionPreference = "Stop" | |
# get current release notes | |
$oldBody = gh release view $env:TAG --repo $env:REPO --json body --template "{{.body}}" | |
# build Attestation URL | |
$attestationId = "${{ steps.attestation.outputs.attestation-id }}" | |
$attestationUrl = "https://github.com/$($env:REPO)/attestations/$attestationId" | |
# join release notes with Attestation url | |
$newBody = "$oldBody`n`nAttestation: $attestationUrl" | |
# save release notes | |
gh release edit $env:TAG --repo $env:REPO --notes "$newBody" | |