.github/workflows/release.yml #3
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 job listens for newly pushed tags and will build + upload a dynamically | ||
# linked below binary as well as full debian packages to release assets. | ||
# | ||
# Note that any consumers of the binary must be compatible with the base image | ||
# in `Dockerfile`. | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*-avx" | ||
permissions: | ||
contents: write | ||
env: | ||
NAME: below | ||
jobs: | ||
build-upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build binary | ||
run: | | ||
docker build -t below . | ||
mkdir -p output | ||
docker run -v $(pwd)/output:/output --entrypoint /bin/bash below -c "cp /below /output" | ||
- name: Build 18.04 debian | ||
run: | | ||
./scripts/build_deb.sh 18.04 | ||
- name: Build 22.04 debian | ||
run: | | ||
./scripts/build_deb.sh 22.04 | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
body: | | ||
Note the binary artifact is dynamically linked. | ||
Please check the base image used in the `Dockerfile` for compability with your system. | ||
generate_release_notes: true | ||
files: | | ||
./output/below | ||
./*.deb | ||
- name: Get Token | ||
id: get_workflow_token | ||
uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db # v2.1.0 | ||
with: | ||
organization: AvxSre | ||
permissions: "contents:read, actions:write" | ||
application_id: ${{ secrets.AVX_WORKFLOW_APPLICATION_ID }} | ||
application_private_key: ${{ secrets.AVX_WORKFLOW_APPLICATION_PRIVATE_KEY }} | ||
# Enable CD and trigger the build of the associated docker image | ||
# see https://github.com/AvxSre/docker-images | ||
- name: Trigger docker image build | ||
env: | ||
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }} | ||
run: | | ||
gh workflow run -R AvxSre/docker-images docker.yml -f "image=tracelogs-analyzer" | ||
- name: Get version | ||
id: get_version | ||
run: | | ||
echo VERSION="$(echo ${{ github.ref_name }})" >> $GITHUB_OUTPUT | ||
- name: Rename binaries | ||
run: | | ||
cp below_*_amd64_18.04.deb below_amd64_18.04.deb | ||
cp below_*_amd64_22.04.deb below_amd64_22.04.deb | ||
- name: Upload binary to Build Artifact Platform | ||
uses: AviatrixTemplates/build-artifact.publish@v1 | ||
with: | ||
files: | | ||
./below_amd64_18.04.deb | ||
./below_amd64_22.04.deb | ||
name: ${{ env.NAME }} | ||
version: v${{ steps.get_version.outputs.VERSION }} | ||
github_token: ${{ steps.get_workflow_token.outputs.token }} | ||
create_update_artifact_pr: | ||
name: Create a pull request to update the build artifact manifest | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
# Github auth is required for build artifact actions | ||
- name: Get Token | ||
id: get_workflow_token | ||
uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db # v2.1.0 | ||
with: | ||
organization: AvxSre | ||
permissions: "contents:read, actions:write" | ||
application_id: ${{ secrets.AVX_WORKFLOW_APPLICATION_ID }} | ||
application_private_key: ${{ secrets.AVX_WORKFLOW_APPLICATION_PRIVATE_KEY }} | ||
- uses: AviatrixTemplates/build-artifact.update-manifest@v1 | ||
with: | ||
branch_name: master | ||
artifact_name: ${{ env.NAME }} | ||
artifact_version: v${{ needs.build-upload.outputs.VERSION }} | ||
github_token: ${{ steps.get_workflow_token.outputs.token }} |