Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat): Add release pipeline for arm64 and amd64 binaries #2

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build 🔨 and Release 🚀

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- architecture: amd64
artifact: ebs-bootstrap-linux-x86_64
- architecture: arm64
artifact: ebs-bootstrap-linux-aarch64
name: Build and Test (${{ matrix.architecture }}) 🔨
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.architecture }}
- name: Build and Test 🔨
run: ./build/docker.sh --architecture ${{ matrix.architecture }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
if-no-files-found: error
retention-days: 1

release:
if: ${{ github.ref_name == github.event.repository.default_branch }} # Only release from the default branch
runs-on: ubuntu-latest
name: Release 🚀
needs:
- test
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- id: version
name: Get next version
uses: reecetech/[email protected]
with:
scheme: semver
increment: patch
- id: github-release
name: Create Github Release 📦
uses: softprops/[email protected]
with:
tag_name: ${{ steps.version.outputs.v-version }}
prerelease: false
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
files: |
*/ebs-bootstrap-linux-*
- id: push-short-tag
name: Create release short tag 🏷
uses: richardsimko/[email protected]
with:
tag_name: ${{ steps.version.outputs.major-v-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 0 additions & 18 deletions .github/workflows/build-and-test.yml

This file was deleted.

16 changes: 2 additions & 14 deletions build/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,10 @@ function map_depedencies() {
fi
}

function get_docker_platform() {
arch="${1:-}"
if [ "${arch}" = 'arm64' ]; then
echo "linux/arm64"
elif [ "${arch}" = 'amd64' ]; then
echo "linux/amd64"
else
>&2 echo "🔴 Unsupported architecture: ${arch}"; exit 1
fi
}

function get_binary_name() {
arch="${1:-}"
if [ "${arch}" = 'arm64' ]; then
echo "ebs-bootstrap-linux-arm64"
echo "ebs-bootstrap-linux-aarch64"
elif [ "${arch}" = 'amd64' ]; then
echo "ebs-bootstrap-linux-x86_64"
else
Expand All @@ -48,8 +37,7 @@ function get_binary_name() {
function docker_build() {
for arch in "${ARCHS[@]}"
do
docker_platform="$(get_docker_platform "${arch}")"
docker build . -t "${IMAGE}:${arch}" --platform "${docker_platform}" --no-cache
docker build . -t "${IMAGE}:${arch}" --platform "linux/${arch}" --no-cache
echo "🟢 Built image: ${IMAGE}:${arch}"
done
}
Expand Down