Skip to content

Commit

Permalink
feat(build): add container build action
Browse files Browse the repository at this point in the history
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
  • Loading branch information
cameronraysmith committed Nov 25, 2023
1 parent abfea96 commit 4d26eb9
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build
env:
ARGO_NAMESPACE: argo
ARGO_VERSION: v3.5.1
CONTAINER_REGISTRY_URL1: 'ghcr.io/sciexp'
CONTAINER_REGISTRY_URL2: 'us.gcr.io/project/pipelines'

on:
push:
branches:
- main
paths-ignore: ["docs/**", "**.md"]
pull_request:
branches:
- main
types: [opened, synchronize, ready_for_review]
paths-ignore: ["docs/**", "**.md"]

workflow_dispatch:
inputs:
debug_enabled:
description: "Run with tmate.io debugging enabled"
required: true
type: boolean
default: false
workflow_call:
inputs:
debug_enabled:
description: "Run with tmate.io debugging enabled"
required: true
type: boolean
default: false

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
skip_after_successful_duplicate: 'true'
build:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: sciexp-runners
steps:
- name: Setup Runner for Argo
run: |
cd $HOME
echo "Install argo"
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz
gunzip argo-linux-amd64.gz
chmod +x argo-linux-amd64
sudo mv ./argo-linux-amd64 /usr/local/bin/argo
argo version
- name: Setup tmate debug session
if: ${{ github.event.inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
- name: Check out repository code
uses: actions/checkout@v3
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- run: echo ${GITHUB_REPOSITORY}
- run: echo ${GITHUB_REPOSITORY_NAME_PART}
- run: echo ${GITHUB_SERVER_URL}
- run: echo ${GITHUB_REPOSITORY_OWNER_PART_SLUG}
- name: build
run: |
echo "commit sha $GITHUB_SHA"
argo version --short
argo submit .argo/build.yaml \
--generate-name="${GITHUB_REPOSITORY_NAME_PART}-build-${GITHUB_SHA_SHORT}-" \
-p appName="${GITHUB_REPOSITORY_NAME_PART}" \
-p branch="${GITHUB_REF_NAME}" \
-p containerFilePath="containers/base.Dockerfile" \
-p containerRegistryURL1="${CONTAINER_REGISTRY_URL1}/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \
-p containerRegistryURL2="${CONTAINER_REGISTRY_URL2}/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \
-p gitUrlNoProtocol="github.com/${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \
-p shortSha="${GITHUB_SHA_SHORT}" \
--wait --log

0 comments on commit 4d26eb9

Please sign in to comment.