Skip to content

Bump actions/checkout from 3 to 4 (#45) #148

Bump actions/checkout from 3 to 4 (#45)

Bump actions/checkout from 3 to 4 (#45) #148

Workflow file for this run

name: Build and Release
on:
push:
workflow_dispatch:
inputs:
component:
description: 'Version component to increment (Use *minor* unless we have breaking changes)'
required: false
type: choice
options:
- minor
- major
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: gardenlinux/workflow-telemetry-action@v1
with:
metric_frequency: 1
comment_on_pr: false
- uses: actions/checkout@v4
- name: build
run: |
sudo apt-get update
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends qemu-user-static
podman login -u token -p ${{ github.token }} ghcr.io
podman build --squash-all --arch amd64 --tag ghcr.io/${{ github.repository }}:amd64-${{ github.sha }} .
podman push ghcr.io/${{ github.repository }}:amd64-${{ github.sha }}
podman build --squash-all --arch arm64 --tag ghcr.io/${{ github.repository }}:arm64-${{ github.sha }} .
podman push ghcr.io/${{ github.repository }}:arm64-${{ github.sha }}
podman manifest create ghcr.io/${{ github.repository }}:${{ github.sha }}
podman manifest add ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:amd64-${{ github.sha }}
podman manifest add ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:arm64-${{ github.sha }}
podman push ghcr.io/${{ github.repository }}:${{ github.sha }}
sed -i 's|container_image=localhost/builder|container_image=ghcr.io/${{ github.repository }}:${{ github.sha }}|' build
- uses: actions/upload-artifact@v3
with:
name: build
path: build
# Run for new commits on the main branch
release-latest:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && github.event.inputs.component == ''
steps:
- uses: actions/checkout@v4
- name: tag latest
run: |
git tag --force latest
git push --force origin latest
- uses: actions/download-artifact@v3
with:
name: build
path: download
- name: create release
run: |
release="$(.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} create latest "Builder (latest)")"
.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} upload "$release" download/build
# Run for new intentional versions, bumping the major or minor version
release-new-version:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && github.event.inputs.component != ''
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: build
path: download
- run: echo Version Component to Increase is ${{ github.event.inputs.component }}
- name: Get Version Number
run: .github/workflows/bump.py ${{ github.event.inputs.component }}
id: bump
- run: echo New version number ${{ steps.bump.outputs.newVersion }}
- name: tag version
run: |
git tag ${{ steps.bump.outputs.newVersion }}
git push origin ${{ steps.bump.outputs.newVersion }}
- name: create release (new version)
run: |
release="$(.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} create ${{ steps.bump.outputs.newVersion }} "Builder (${{ steps.bump.outputs.newVersion }})")"
.github/workflows/release.sh ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} upload "$release" download/build