3 Commits

Author SHA1 Message Date
16acb0fe80 Revert "refactor: cicd cd workflow depends on ci workflow success (#11)"
This reverts commit 62a05d5e1e.
2024-08-11 12:32:15 +02:00
7739f324f3 Revert "fix: cicd dependency between workflow (#12)"
This reverts commit 1a25992f03.
2024-08-11 12:32:15 +02:00
a7e50bcec9 Revert "fix: cicd workflow interdependency (#13)"
This reverts commit e0412f87b6.
2024-08-11 12:32:15 +02:00
2 changed files with 46 additions and 17 deletions

View File

@@ -1,43 +1,76 @@
name: CD name: CD
on: on:
workflow_run: push:
workflows: ["ci.yaml"] branches:
branches: [main] - main
types:
- completed
env: env:
DOCKER_REGISTRY: gitea.t000-n.de DOCKER_REGISTRY: gitea.t000-n.de
jobs: jobs:
build_and_push: test:
name: Build and push name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Create cache key
uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: actions/cache@v4
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
restore-keys: |-
go_cache-${{ steps.hash-go.outputs.hash }}
- name: build
run: make build
- name: test
run: make test
build_and_push:
name: Build and push
requires:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to Registry - name: Login to Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ${{ env.DOCKER_REGISTRY }} registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Metadata - name: Get Metadata
id: meta id: meta
run: | run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push - name: Build and push
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:

View File

@@ -1,10 +1,6 @@
name: CI name: CI
on: on:
pull_request: pull_request:
push:
branches:
- main
env: env:
GOPATH: /go_path GOPATH: /go_path
@@ -39,7 +35,7 @@ jobs:
/go_cache /go_cache
key: go_path-${{ steps.hash-go.outputs.hash }} key: go_path-${{ steps.hash-go.outputs.hash }}
restore-keys: |- restore-keys: |-
go_cache-${{ steps.hash-go.outputs.hash }} go_cache-${{ steps.hash-go.outputs.hash }}
- name: build - name: build
run: make build run: make build
- name: test - name: test