Subsections of Template
Apply And Sync Argocd APP
name: apply-and-sync-app
run-name: ${{ gitea.actor }} is going to sync an sample argocd app π
on: [push]
jobs:
sync-argocd-app:
runs-on: ubuntu-latest
steps:
- name: Sync App
uses: AaronYang0628/apply-and-sync-argocd@v1.0.6
with:
argocd-server: '192.168.100.125:30443'
argocd-token: ${{ secrets.ARGOCD_TOKEN }}
application-yaml-path: "environments/ops/argocd/operator.app.yaml"Publish Chart 2 Harbor
name: publish-chart-to-harbor-registry
run-name: ${{ gitea.actor }} is testing out Gitea Push Chart π
on: [push]
env:
REGISTRY: harbor.zhejianglab.com
USER: byang628@zhejianglab.com
REPOSITORY_NAMESPACE: ay-dev
CHART_NAME: data-warehouse
jobs:
build-and-push-charts:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- chart_path: "environments/helm/metadata-environment"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Harbor
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: "${{ env.REGISTRY }}"
username: "${{ env.USER }}"
password: "${{ secrets.ZJ_HARBOR_TOKEN }}"
- name: Helm Publish Action
uses: AaronYang0628/push-helm-chart-to-oci@v0.0.3
with:
working-dir: ${{ matrix.chart_path }}
oci-repository: oci://${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}
username: ${{ env.USER }}
password: ${{ secrets.ZJ_HARBOR_TOKEN }}Publish Image 2 Dockerhub
name: publish-image-to-ghcr
run-name: ${{ gitea.actor }} is testing out Gitea Push Image π
on: [push]
env:
REGISTRY: ghcr.io
USER: aaronyang0628
REPOSITORY_NAMESPACE: aaronyang0628
jobs:
build-and-push-images:
strategy:
matrix:
include:
- name_suffix: "aria-ng"
container_path: "application/aria2/container/aria-ng"
dockerfile_path: "application/aria2/container/aria-ng/Dockerfile"
- name_suffix: "aria2"
container_path: "application/aria2/container/aria2"
dockerfile_path: "application/aria2/container/aria2/Dockerfile"
runs-on: ubuntu-latest
steps:
- name: checkout-repository
uses: actions/checkout@v4
- name: log in to the container registry
uses: docker/login-action@v3
with:
registry: "${{ env.REGISTRY }}"
username: "${{ env.USER }}"
password: "${{ secrets.GIT_REGISTRY_PWD }}"
- name: build and push container image
uses: docker/build-push-action@v6
with:
context: "${{ matrix.container_path }}"
file: "${{ matrix.dockerfile_path }}"
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ github.repository }}-${{ matrix.name_suffix }}:${{ inputs.tag || 'latest' }}
${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ github.repository }}-${{ matrix.name_suffix }}:${{ github.ref_name }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}Publish Image 2 Ghcr
name: publish-image-to-ghcr
run-name: ${{ gitea.actor }} is testing out Gitea Push Image π
on: [push]
env:
REGISTRY: ghcr.io
USER: aaronyang0628
REPOSITORY_NAMESPACE: aaronyang0628
jobs:
build-and-push-images:
strategy:
matrix:
include:
- name_suffix: "aria-ng"
container_path: "application/aria2/container/aria-ng"
dockerfile_path: "application/aria2/container/aria-ng/Dockerfile"
- name_suffix: "aria2"
container_path: "application/aria2/container/aria2"
dockerfile_path: "application/aria2/container/aria2/Dockerfile"
runs-on: ubuntu-latest
steps:
- name: checkout-repository
uses: actions/checkout@v4
- name: log in to the container registry
uses: docker/login-action@v3
with:
registry: "${{ env.REGISTRY }}"
username: "${{ env.USER }}"
password: "${{ secrets.GIT_REGISTRY_PWD }}"
- name: build and push container image
uses: docker/build-push-action@v6
with:
context: "${{ matrix.container_path }}"
file: "${{ matrix.dockerfile_path }}"
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ github.repository }}-${{ matrix.name_suffix }}:${{ inputs.tag || 'latest' }}
${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ github.repository }}-${{ matrix.name_suffix }}:${{ github.ref_name }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}Publish Image 2 Harbor
name: publish-image-to-harbor-registry
run-name: ${{ gitea.actor }} is testing out Gitea Push Image π
on: [push]
env:
REGISTRY: harbor.zhejianglab.com
USER: byang628@zhejianglab.com
REPOSITORY_NAMESPACE: ay-dev
IMAGE_NAME: metadata-crd-operator
jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- name_suffix: "dev"
container_path: "."
dockerfile_path: "./Dockerfile"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Log in to Harbor
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: "${{ env.REGISTRY }}"
username: "${{ env.USER }}"
password: "${{ secrets.ZJ_HARBOR_TOKEN }}"
- name: Extract Current Date
id: extract-date
run: |
echo "current-date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
echo will push image: ${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ env.IMAGE_NAME }}-${{ matrix.name_suffix }}:v${{ steps.extract-date.outputs.current-date }}
- name: Build And Push Container Image
uses: docker/build-push-action@v6
with:
context: "${{ matrix.container_path }}"
file: "${{ matrix.dockerfile_path }}"
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY_NAMESPACE }}/${{ env.IMAGE_NAME }}-${{ matrix.name_suffix }}:v${{ steps.extract-date.outputs.current-date }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}