Skip to content

chore(release): upload binary to s3 (#71) #16

chore(release): upload binary to s3 (#71)

chore(release): upload binary to s3 (#71) #16

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
id-token: write
packages: read
env:
GH_TOKEN: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-release:
runs-on: ubuntu-latest
steps:
- name: Create Release
run: |
gh release create \
${{ github.ref_name }} \
-R ${{ github.repository }} \
--generate-notes \
--draft
release:
runs-on: ubuntu-latest
needs: pre-release
strategy:
fail-fast: true
matrix:
target:
- initrd
- applehv-rootfs
- kernel
arch:
- arm64
- amd64
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Update kernel submodules
if: ${{ matrix.target == 'kernel'}}
run: git submodule update --init kernel
- name: Update buildroot submodules
if: ${{ matrix.target != 'kernel'}}
run: git submodule update --init buildroot
- name: Install deps
run: sudo apt-get install -y build-essential flex bison libssl-dev libelf-dev bc
- name: Install kernel arm64 deps
if: ${{ matrix.target == 'kernel' && matrix.arch == 'arm64'}}
run: sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Defconfig
run: make defconfig-${{ matrix.target }}-${{ matrix.arch }}
- name: Build
run: make build-${{ matrix.target }}-${{ matrix.arch }} -j$(nproc)
- name: Upload binaries
run: |
OUTPATH=$(make print-outpath-${{ matrix.target }}-${{ matrix.arch }})
FILENAME=`basename $OUTPATH`
NEW_FILENAME=${{ matrix.target }}-${{ matrix.arch }}.$FILENAME
cp $OUTPATH $NEW_FILENAME
gh release upload \
${{ github.ref_name }} \
./$NEW_FILENAME \
-R ${{ github.repository }} \
--clobber
post-release:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- pre-release
- release
steps:
- name: Update Release
if: ${{ needs.release.result == 'success' }}
run: |
gh release edit \
${{ github.ref_name }} \
-R ${{ github.repository }} \
--draft=false
- name: Delete Release and Tag
if: ${{ needs.release.result != 'success' }}
run: |
gh release delete \
${{ github.ref_name }} \
-R ${{ github.repository }} \
--cleanup-tag \
--yes
upload:
runs-on: ubuntu-latest
needs: post-release
if: ${{ success() }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: "arn:aws:iam::${{ secrets.AWS_IAM_ACCOUNT_ID }}:role/github-action-oomol-lab-ovm-core"
role-session-name: "github-action-oomol-lab-ovm-core"
aws-region: us-east-1
- name: Download Release
working-directory: ./out
run: |
gh release download \
${{ github.ref_name }} \
-R ${{ github.repository }}
- name: Upload To S3
run: |
aws s3 cp \
./out/ \
s3://oomol-static/ovm-resources/ovm-core/${{ github.ref_name }} \
--recursive --include "*"