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
# | ||
# This GitHub action triggers a fresh set of Packer builds | ||
# and publishes them to GitHub Releases under a specific tag. | ||
# Note that artifacts available via GitHub Releases are not codesigned or notarized. | ||
# Failures are reported to slack. | ||
# | ||
name: Tagged Release | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- 'nightly' | ||
permissions: | ||
contents: write | ||
jobs: | ||
# Build a fresh set of artifacts | ||
build-artifacts: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: hashicorp/packer-internal/.github/workflows/build.yml@main | ||
Check failure on line 24 in .github/workflows/tagged-release.yml GitHub Actions / .github/workflows/tagged-release.ymlInvalid workflow file
|
||
secrets: inherit | ||
github-release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: Download built artifacts | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
path: out/ | ||
# Set BUILD_OUTPUT_LIST to out\<project>-<version>.<fileext>\*,out\... | ||
# This is needed to attach the build artifacts to the GitHub Release | ||
- name: Set BUILD_OUTPUT_LIST | ||
run: | | ||
echo "$(ls -xm1 out/)" > tmp.txt | ||
cat tmp.txt | sed 's:.*:out/&/*:' > tmp2.txt | ||
echo "BUILD_OUTPUT_LIST=$(cat tmp2.txt | tr '\n' ',' | perl -ple 'chop')" >> $GITHUB_ENV | ||
rm -rf tmp.txt && rm -rf tmp2.txt | ||
- name: Advance Dev tag | ||
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
try { | ||
await github.rest.git.deleteRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "tags/${{ github.ref_name}}" | ||
}) | ||
} catch (e) { | ||
console.log("Warning: The tag doesn't exist yet, so there's nothing to do. Trace: " + e) | ||
} | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "${{ github.ref }}", | ||
sha: context.sha | ||
}) | ||
- name: Create a GitHub prerelease | ||
id: create_prerelease | ||
continue-on-error: true | ||
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0 | ||
with: | ||
name: ${{ github.ref_name }} | ||
artifacts: "${{ env.BUILD_OUTPUT_LIST }}" | ||
tag: ${{ github.ref_name }} | ||
bodyFile: ".github/workflows/nightly-release-readme.md" | ||
prerelease: true | ||
allowUpdates: true | ||
removeArtifacts: true | ||
draft: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Store GitHub Release ID | ||
if: steps.create_prerelease.outcome == 'success' | ||
run: | | ||
echo "prerelease_id=${{ steps.create_prerelease.outputs.id }}" >> $GITHUB_ENV | ||
- name: Sleep before retry | ||
id: sleep_before_retry | ||
if: steps.create_prerelease.outcome == 'failure' | ||
run : sleep 30m | ||
shell: bash | ||
- name: Retry failed GitHub prerelease | ||
id: create_prerelease_retry | ||
if: steps.create_prerelease.outcome == 'failure' | ||
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0 | ||
with: | ||
name: ${{ github.ref_name }} | ||
artifacts: "${{ env.BUILD_OUTPUT_LIST }}" | ||
tag: ${{ github.ref_name }} | ||
prerelease: true | ||
allowUpdates: true | ||
removeArtifacts: true | ||
draft: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Store Updated GitHub Release ID | ||
if: steps.create_prerelease_retry.outcome == 'success' | ||
run: | | ||
echo "prerelease_id=${{ steps.create_prerelease_retry.outputs.id }}" >> $GITHUB_ENV | ||
- name: Publish GitHub prerelease | ||
uses: eregon/publish-release@46913fa2b3f7edc7345ae3c17f6d1b093a54916d # v1.0.5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
release_id: ${{ env.prerelease_id }} |