Skip to content

support non-default branches in apps (#89) #14

support non-default branches in apps (#89)

support non-default branches in apps (#89) #14

on:
push:
branches:
- main
env:
FS_IMAGE: ghcr.io/${{ github.repository }}
jobs:
set-version:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
# need to get everything so that 'git describe' works
fetch-depth: 0
- run: |
echo "export GIT_COMMIT=$(git rev-parse --short HEAD)" >> vars.sh
echo "export GIT_TAG=$(git describe)" >> vars.sh
- uses: actions/upload-artifact@v3
with:
name: vars.sh
path: vars.sh
release-docker:
runs-on: ubuntu-22.04
needs:
- set-version
permissions:
contents: read
packages: write
strategy:
matrix:
platform:
# - { earthly: linux/arm64, suffix: linux-arm64 }
- { earthly: linux/amd64, suffix: linux-amd64 }
steps:
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
if: matrix.platform == 'linux/arm64'
- uses: actions/checkout@v3
- uses: wistia/[email protected]
- uses: earthly/actions-setup@v1
with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" }
- name: login to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: vars.sh
- name: Build and push the Docker image
run: |
source vars.sh
./earthly \
--platform ${{ matrix.platform.earthly }} \
--push \
+docker \
--GIT_TAG=${GIT_TAG} \
--GIT_COMMIT=${GIT_COMMIT} \
--IMAGE_NAME=${{ env.FS_IMAGE }}:${GIT_TAG}
release-multiarch:
runs-on: ubuntu-22.04
needs:
- release-docker
permissions:
packages: write
steps:
- name: login to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: vars.sh
- name: extract sha
run: source vars.sh
- uses: int128/docker-manifest-create-action@v1
with:
tags: ghcr.io/${{ github.repository_owner }}/kubechecks:${env.GIT_TAG}
suffixes: |
-linux-amd64
# -linux-arm64
release-helm:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: checkout the source code
uses: actions/checkout@v3
- uses: wistia/[email protected]
- uses: earthly/actions-setup@v1
with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" }
- name: Build and push the helm charts
run: |
earthly \
--push \
+release-helm \
--repo_owner ${{ github.repository_owner }} \
--token ${{ secrets.GITHUB_TOKEN }}