From 6b0f6948d2a6b58857601e38e2c4b7820ef826ac Mon Sep 17 00:00:00 2001 From: Alex Savin Date: Tue, 29 Apr 2025 12:49:17 -0400 Subject: [PATCH] Update .github/workflows/CI.yml --- .github/workflows/CI.yml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d9559df..4ccb95e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,6 +22,7 @@ on: jobs: + testing: strategy: matrix: @@ -36,6 +37,7 @@ jobs: - run: | go get -u . go test ./. + build-and-push: runs-on: ubuntu-latest steps: @@ -45,6 +47,9 @@ jobs: echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT 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_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}" @@ -55,7 +60,7 @@ jobs: # echo ${{steps.version_step.outputs.latest_tag}} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx + - name: Set up Docker BuildX uses: docker/setup-buildx-action@v3 with: platforms: | @@ -81,7 +86,8 @@ jobs: linux/amd64 push: true 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 }} # latest # build-args: | @@ -93,16 +99,26 @@ jobs: # ${{env.VERSION_TAG}} # ${{env.LASTEST_TAG}} - - 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: Auto Execute a Workflow + run: | + curl -X 'POST' \ + 'http://10.10.11.26:8090/api/v1/repos/${{ github.repository_owner }}/${{ github.repository.name }}/actions/workflows/CD.yml/dispatches' \ + -H 'Accept: application/json' \ + -H 'Content-Type: application/json' \ + -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 id: output-summary shell: bash 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