refactor(#3): ♻️ run docker build once
Some checks failed
ci / build (push) Failing after 45s
Some checks failed
ci / build (push) Failing after 45s
This commit is contained in:
parent
da08f62a79
commit
be1b1f0b3a
1 changed files with 21 additions and 90 deletions
|
@ -9,7 +9,23 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.24'
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: go.sum
|
||||||
|
|
||||||
|
- name: Validate Go Modules
|
||||||
|
run: |
|
||||||
|
go mod tidy
|
||||||
|
git diff --exit-code go.sum || echo "go.sum was updated; please commit changes"
|
||||||
|
go mod download
|
||||||
|
|
||||||
|
- name: Run Unit Tests
|
||||||
|
run: go test ./... -v
|
||||||
|
|
||||||
- name: Repository meta
|
- name: Repository meta
|
||||||
id: repository
|
id: repository
|
||||||
run: |
|
run: |
|
||||||
|
@ -51,7 +67,7 @@ jobs:
|
||||||
push: false
|
push: false
|
||||||
allow: network.host
|
allow: network.host
|
||||||
network: host
|
network: host
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ${{ steps.docker.outputs.tags }}
|
tags: ${{ steps.docker.outputs.tags }}
|
||||||
outputs: type=docker
|
outputs: type=docker
|
||||||
no-cache: false
|
no-cache: false
|
||||||
|
@ -72,91 +88,6 @@ jobs:
|
||||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||||
|
|
||||||
- name: Push Docker Image
|
- name: Push Docker Image
|
||||||
uses: docker/build-push-action@v6
|
run: |
|
||||||
with:
|
docker push ${{ steps.docker.outputs.tags | split('\n') | first }}
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
allow: network.host
|
|
||||||
network: host
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
tags: ${{ steps.docker.outputs.tags }}
|
|
||||||
no-cache: false
|
|
||||||
|
|
||||||
# name: CI/CD Pipeline
|
|
||||||
# on: push
|
|
||||||
# env:
|
|
||||||
# FORGEJO_BASE_URL: ${{ vars.FORGEJO_BASE_URL }}
|
|
||||||
# jobs:
|
|
||||||
# build-and-deploy:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout Code
|
|
||||||
# uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# - name: DEBUG VARS
|
|
||||||
# run: |
|
|
||||||
# env
|
|
||||||
# echo "---"
|
|
||||||
# echo "GITHUB_SERVER_URL: ${{ env.GITHUB_SERVER_URL }}"
|
|
||||||
# echo "GITHUB_REPOSITORY_OWNER: ${{ secret.GITHUB_REPOSITORY_OWNER }}"
|
|
||||||
# echo "GITHUB_REPOSITORY_OWNER: ${{ env.GITHUB_REPOSITORY_OWNER }}"
|
|
||||||
# echo "GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}"
|
|
||||||
# echo "GITHUB_SHA: ${{ github.sha }}"
|
|
||||||
# echo "FORGEJO_BASE_URL: ${{ vars.FORGEJO_BASE_URL }}"
|
|
||||||
# echo "GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
# echo "GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}"
|
|
||||||
|
|
||||||
# - name: Set up Docker Buildx
|
|
||||||
# uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
|
|
||||||
# - name: Login to Forgejo Registry
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# registry: ${{ env.GITHUB_SERVER_URL }}
|
|
||||||
# username: ${{ env.GITHUB_REPOSITORY_OWNER }}
|
|
||||||
# password: ${{ secret.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# - name: Build and Push Docker Image
|
|
||||||
# uses: docker/build-push-action@v5
|
|
||||||
# with:
|
|
||||||
# context: .
|
|
||||||
# push: true
|
|
||||||
# tags: ${{ env.GITHUB_SERVER_URL }}/${{ secret.GITHUB_REPOSITORY_OWNER }}/loic:${{ github.sha }}
|
|
||||||
|
|
||||||
# - name: Set up Go
|
|
||||||
# uses: actions/setup-go@v3
|
|
||||||
# with:
|
|
||||||
# go-version: '1.24'
|
|
||||||
# - name: Build Go Binary
|
|
||||||
# run: go mod tidy && go build -o loic
|
|
||||||
# - name: Test Go Binary
|
|
||||||
# run: go test
|
|
||||||
# - name: Debug Variables
|
|
||||||
# run: |
|
|
||||||
# env
|
|
||||||
# echo "Commit SHA: $GITHUB_SHA"
|
|
||||||
# echo "Identity: {{ .Identity }}"
|
|
||||||
# echo "Forgejo Base URL: $FORGEJO_BASE_URL"
|
|
||||||
# - name: Build and Push Docker Image
|
|
||||||
# run: |
|
|
||||||
# echo "Building Docker image..."
|
|
||||||
# docker build -t loic:${{ github.sha }} . || { echo "Docker build failed"; exit 1; }
|
|
||||||
# echo "Tagging image..."
|
|
||||||
# docker tag loic:${{ github.sha }} ${{ env.FORGEJO_BASE_URL }}/{{ .Identity }}/loic:${{ github.sha }} || { echo "Docker tag failed"; exit 1; }
|
|
||||||
# echo "Logging in to Forgejo registry..."
|
|
||||||
# docker login -u {{ .Identity }} --password-stdin ${{ secret.PASSWORD }} || { echo "Docker login failed"; exit 1; }
|
|
||||||
# echo "Pushing Docker image..."
|
|
||||||
# docker push ${{ env.FORGEJO_BASE_URL }}/{{ .Identity }}/loic:${{ github.sha }} || { echo "Docker push failed"; exit 1; }
|
|
||||||
# echo "Done!"
|
|
||||||
|
|
||||||
# - name: Update Deployment Manifest
|
|
||||||
# run: |
|
|
||||||
# sed -i "s|image: .*|image: ${{ env.FORGEJO_BASE_URL }}/{{ .Identity }}/loic:${{ github.sha }}|" k8s/deployment.yaml
|
|
||||||
# git config --global user.email "ci@edp.local"
|
|
||||||
# git config --global user.name "CI Bot"
|
|
||||||
# git add k8s/deployment.yaml
|
|
||||||
# git commit -m "Update image to ${{ github.sha }}"
|
|
||||||
# git push
|
|
||||||
env:
|
|
||||||
FORGEJO_API_TOKEN: ${{ secrets.FORGEJO_API_TOKEN }}
|
|
Loading…
Reference in a new issue