Skip to content

Commit

Permalink
testing composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinblack committed May 2, 2024
1 parent b72dbf8 commit c90b8de
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 33 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/act_init.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: ACT Build Init
runs:
using: "composite"
steps:
- name: Set image tag for release
if: github.event_name == 'release'
run: |
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set image tag for main
if: github.ref == 'refs/heads/main' && github.event_name != 'release'
run: |
echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV
- name: Set image tag and expiration for dev
if: github.ref != 'refs/heads/main' && github.event_name != 'release'
run: |
export commit_hash=${{ github.sha }}
echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV
echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV
- name: Checkout this project
uses: actions/checkout@v4

- name: arcaflow-container-toolkit-action
uses: arcalot/[email protected]
with:
image_name: ${{ inputs.image_name }}
image_tag: ${{ inputs.image_tag }}
github_username: ${{ inputs.github_username }}
github_password: ${{ secrets.GITHUB_TOKEN }}
github_namespace: ${{ inputs.github_namespace }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
quay_namespace: ${{ secrets.QUAY_NAMESPACE }}
quay_custom_namespace: ${{ inputs.quay_custom_namespace }}
quay_img_exp: ${{ inputs.quay_img_exp }}
build_timeout: ${{ inputs.build_timeout }}
archetype: ${{ inputs.archetype }}
req_check_only: ${{ inputs.multi_arch }}

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Log in to quay.io for multi-arch
if: ${{ inputs.multi_arch }}
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
114 changes: 81 additions & 33 deletions .github/workflows/reusable_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,67 @@ on:
required: false

jobs:
act-build:
name: Build ${{ github.ref_name }} from ${{ github.event_name }}
runs-on: ubuntu-latest
steps:
- name: Set image tag for release
if: github.event_name == 'release'
run: |
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# act-init:
# name: Init ${{ github.ref_name }} from ${{ github.event_name }}
# runs-on: ubuntu-latest
# steps:
# - name: Set image tag for release
# if: github.event_name == 'release'
# run: |
# echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set image tag for main
if: github.ref == 'refs/heads/main' && github.event_name != 'release'
run: |
echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV
# - name: Set image tag for main
# if: github.ref == 'refs/heads/main' && github.event_name != 'release'
# run: |
# echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV

- name: Set image tag and expiration for dev
if: github.ref != 'refs/heads/main' && github.event_name != 'release'
run: |
export commit_hash=${{ github.sha }}
echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV
echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV
# - name: Set image tag and expiration for dev
# if: github.ref != 'refs/heads/main' && github.event_name != 'release'
# run: |
# export commit_hash=${{ github.sha }}
# echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV
# echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV

- name: Checkout this project
uses: actions/checkout@v4
# - name: Checkout this project
# uses: actions/checkout@v4

- name: arcaflow-container-toolkit-action
uses: arcalot/[email protected]
# - name: arcaflow-container-toolkit-action
# uses: arcalot/[email protected]
# with:
# image_name: ${{ inputs.image_name }}
# image_tag: ${{ inputs.image_tag }}
# github_username: ${{ inputs.github_username }}
# github_password: ${{ secrets.GITHUB_TOKEN }}
# github_namespace: ${{ inputs.github_namespace }}
# quay_username: ${{ secrets.QUAY_USERNAME }}
# quay_password: ${{ secrets.QUAY_PASSWORD }}
# quay_namespace: ${{ secrets.QUAY_NAMESPACE }}
# quay_custom_namespace: ${{ inputs.quay_custom_namespace }}
# quay_img_exp: ${{ inputs.quay_img_exp }}
# build_timeout: ${{ inputs.build_timeout }}
# archetype: ${{ inputs.archetype }}
# req_check_only: ${{ inputs.multi_arch }}

# - name: Install qemu dependency
# run: |
# sudo apt-get update
# sudo apt-get install -y qemu-user-static

# - name: Log in to quay.io for multi-arch
# if: ${{ inputs.multi_arch }}
# uses: redhat-actions/podman-login@v1
# with:
# registry: quay.io
# username: ${{ secrets.QUAY_USERNAME }}
# password: ${{ secrets.QUAY_PASSWORD }}

act-build-release:
name: Build ${{ github.ref_name }} from ${{ github.event_name }}
if: github.event_name == 'release' && inputs.multi_arch == true
runs-on: ubuntu-latest
steps:
- name: Initialize ACT
uses: ./.github/actions/act_init.yaml
with:
image_name: ${{ inputs.image_name }}
image_tag: ${{ inputs.image_tag }}
Expand All @@ -75,17 +110,6 @@ jobs:
build_timeout: ${{ inputs.build_timeout }}
archetype: ${{ inputs.archetype }}
req_check_only: ${{ inputs.multi_arch }}

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Log in to quay.io for multi-arch
if: ${{ inputs.multi_arch }}
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

Expand Down Expand Up @@ -113,6 +137,30 @@ jobs:
- name: Print release image url
if: github.event_name == 'release' && inputs.multi_arch == true
run: echo "Image pushed to ${{ steps.push-release-to-quay.outputs.registry-paths }}"

act-build-dev:
name: Build ${{ github.ref_name }} from ${{ github.event_name }}
if: github.event_name == 'release' && inputs.multi_arch == true
runs-on: ubuntu-latest
steps:
- name: Initialize ACT
uses: ./.github/actions/act_init.yaml
with:
image_name: ${{ inputs.image_name }}
image_tag: ${{ inputs.image_tag }}
github_username: ${{ inputs.github_username }}
github_password: ${{ secrets.GITHUB_TOKEN }}
github_namespace: ${{ inputs.github_namespace }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
quay_namespace: ${{ secrets.QUAY_NAMESPACE }}
quay_custom_namespace: ${{ inputs.quay_custom_namespace }}
quay_img_exp: ${{ inputs.quay_img_exp }}
build_timeout: ${{ inputs.build_timeout }}
archetype: ${{ inputs.archetype }}
req_check_only: ${{ inputs.multi_arch }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build multi-arch image for dev
id: build-multi-arch-dev
Expand Down

0 comments on commit c90b8de

Please sign in to comment.