Skip to content

Trigger release build #20

Trigger release build

Trigger release build #20

Workflow file for this run

name: Trigger release build
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch: # This allows manual triggering
permissions:
contents: write # This gives the workflow permission to create releases
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('.cfg/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build toolchain
uses: docker/build-push-action@v2
with:
context: .
file: .cfg/Dockerfile
load: true
tags: aarch64_musl_cross:v1.0
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Run build script
run: |
chmod +x build.sh
./build.sh
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ steps.slug.outputs.sha8 }}
release_name: Release ${{ steps.slug.outputs.sha8 }}
draft: false
prerelease: false
body: |
Latest binary builds from commit ${{ steps.slug.outputs.sha8 }}.
- name: Upload Release Assets
run: |
set -x
for file in binaries/*; do
echo "Uploading $file"
if [[ "$file" == *.tar.gz ]]; then
mime_type="application/gzip"
else
mime_type=$(file -b --mime-type "$file")
fi
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $mime_type" \
--data-binary @"$file" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename "$file")"
done
- name: Update latest release
run: |
curl -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }} \
-d '{"make_latest": "true"}'