Skip to content

APPS-1433 Fix Docker build for arm64 in v2 (#294) #17

APPS-1433 Fix Docker build for arm64 in v2 (#294)

APPS-1433 Fix Docker build for arm64 in v2 (#294) #17

Workflow file for this run

name: Create a Release and Push Release assets
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Check if release exists
id: check-release
uses: actions/github-script@v7
with:
script: |
try {
const response = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: "${{ github.ref_name }}"
});
if (response.status === 200) {
console.log(`Release with tag exists.`);
core.setOutput('release-exists', 'true');
}
} catch (error) {
if (error.status === 404) {
console.log(`Release with tag does not exist.`);
core.setOutput('release-exists', 'false');
} else {
throw error;
}
}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/create-release@v1
if: ${{ steps.check-release.outputs.release-exists == 'false'}}
id: create-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: true
prerelease: true
build-artifacts:
needs:
- create-release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.x"
- name: Install Dependencies
run: |
go install "github.com/goreleaser/nfpm/v2/cmd/nfpm@latest"
- name: Build Packages
run: |
make packages
- name: Find files matching "*.rpm" "*.deb" and "*sha256"
run: |
ASSET_LIST=$(find . -type f \( -name "*.deb" -or -name "*.rpm" -or -name "*.sha256" \) | tr '\n' ',')
echo "ASSET_LIST=$ASSET_LIST" >> $GITHUB_ENV
- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
upload_url="$(echo "${{ needs.create-release.outputs.upload_url }}" | sed 's/\(assets\).*/\1/')"
IFS=',' read -r -a asset_array <<< "$ASSET_LIST"
for file in "${asset_array[@]}"; do
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: $(file -b --mime-type $file)" \
"$upload_url?name=$(basename $file)" \
--data-binary "@$file"
done