Update .github/workflows/CI.yml
All checks were successful
GHA Testing / gha-testing (push) Successful in 2s

This commit is contained in:
Alex Savin
2025-04-29 12:49:17 -04:00
parent b627fcf3d9
commit 6b0f6948d2

View File

@ -22,6 +22,7 @@ on:
jobs: jobs:
testing: testing:
strategy: strategy:
matrix: matrix:
@ -36,6 +37,7 @@ jobs:
- run: | - run: |
go get -u . go get -u .
go test ./. go test ./.
build-and-push: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -45,6 +47,9 @@ jobs:
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT
echo RELEASE_DATE=$(date --rfc-3339=date) >> ${GITHUB_ENV} echo RELEASE_DATE=$(date --rfc-3339=date) >> ${GITHUB_ENV}
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# echo "##[set-output name=version;]VERSION=${GITHUB_REF#$"refs/tags/v"}" # echo "##[set-output name=version;]VERSION=${GITHUB_REF#$"refs/tags/v"}"
# echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}" # echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}"
@ -55,7 +60,7 @@ jobs:
# echo ${{steps.version_step.outputs.latest_tag}} # echo ${{steps.version_step.outputs.latest_tag}}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
platforms: | platforms: |
@ -81,7 +86,8 @@ jobs:
linux/amd64 linux/amd64
push: true push: true
tags: | tags: |
docker.savin.nyc/${{ github.event.repository.name }}:latest docker.savin.nyc/${{ github.event.repository.name }}:nightly
docker.savin.nyc/${{ github.event.repository.name }}:${{ steps.vars.outputs.sha_short }}
# ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} # ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
# latest # latest
# build-args: | # build-args: |
@ -93,16 +99,26 @@ jobs:
# ${{env.VERSION_TAG}} # ${{env.VERSION_TAG}}
# ${{env.LASTEST_TAG}} # ${{env.LASTEST_TAG}}
- name: Auto Deploy (Dev) - name: Auto Execute a Workflow
# if: ${{ contains(github.ref, 'develop') and env.AUTO_DEPLOY_DEV == 'true' }} run: |
id: auto-deploy-dev curl -X 'POST' \
uses: https://git.savin.nyc/gh-actions/auto-exec-workflow@v1 'http://10.10.11.26:8090/api/v1/repos/${{ github.repository_owner }}/${{ github.repository.name }}/actions/workflows/CD.yml/dispatches' \
with: -H 'Accept: application/json' \
GITEA_TOKEN: ${{ secrets.GHA_TOKEN }} -H 'Content-Type: application/json' \
Version: ${{ steps.version.output.updated-version }} -H 'Authorization: Basic ${{ echo -n "secrets.SECRET_USERNAME:secrets.SECRET_PASSWORD" | base64 }}' \
-H 'Authorization: token ${{ secrets.GHA_TOKEN }}' \
-d '{"ref":"${{ github.ref }}","inputs":{"Version":"${{ steps.vars.outputs.sha_short }}","Env":"${{ github.ref_name}}"}}'
shell: bash
# - name: Auto Deploy (Dev)
## if: ${{ contains(github.ref, 'develop') and env.AUTO_DEPLOY_DEV == 'true' }}
# id: auto-deploy-dev
# uses: https://git.savin.nyc/gh-actions/auto-exec-workflow@v1
# with:
# GITEA_TOKEN: ${{ secrets.GHA_TOKEN }}
# Version: ${{ steps.version.output.updated-version }}
- name: Output Summary - name: Output Summary
id: output-summary id: output-summary
shell: bash shell: bash
run: | run: |
echo "CI pipeline has been compiled for ${{ github.repository }} with a new version ${{ steps.version.output.updated-version }}" >> $GITHUB_STEP_SUMMARY echo "CI pipeline has been compiled for ${{ github.repository }} with a new version ${{ steps.vars.outputs.sha_short }}" >> $GITHUB_STEP_SUMMARY