Skip to content

prerelease

prerelease #11

Workflow file for this run

name: prerelease
on:
workflow_dispatch:
inputs:
sha:
description: "SHA (leave blank for HEAD)"
required: false
env:
ACTIONS_API_URL: https://api.github.com/repos/${GITHUB_REPOSITORY}/actions
jobs:
version:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
sha7: ${{ steps.sha.outputs.sha7 }}
steps:
- id: sha
run: |
SHA=$(if [[ "${{ github.event.inputs.sha }}" ]]; then echo "${{ github.event.inputs.sha }}"; else echo "${GITHUB_SHA}"; fi)
SHA7="${SHA::7}"
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
prerelease:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- id: download
run: |
curl -s "${{ env.ACTIONS_API_URL }}/runs" --output runs.json
RUN_ID=$(jq -r --arg SHA "${{ needs.version.outputs.sha }}" --arg NAME "b2s-backglass" '.workflow_runs[] | select(.head_sha==$SHA and .name==$NAME) | .id' runs.json)
echo "Downloading b2s-backglass artifact list ${RUN_ID}..."
curl -s "${{ env.ACTIONS_API_URL }}/runs/${RUN_ID}/artifacts" --output artifacts.json
ARTIFACTS=($(jq -r '.artifacts[] | .archive_download_url' artifacts.json))
for url in ${ARTIFACTS[@]}
do
echo "Downloading artifact: ${url}..."
curl -s -OJ -L -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ${url}
done
rm *.json
- id: create_release
uses: ncipollo/release-action@v1
with:
prerelease: true
name: "b2s-backglass-${{ needs.version.outputs.sha7 }}"
tag: "b2s-backglass-${{ needs.version.outputs.sha7 }}"
commit: ${{ needs.version.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "*"