fix(#3): 👷 Use actions for docker build
Some checks failed
CI/CD Pipeline / build-and-deploy (push) Failing after 12s
Some checks failed
CI/CD Pipeline / build-and-deploy (push) Failing after 12s
This commit is contained in:
parent
cd6c11b9c7
commit
57ec2fa826
1 changed files with 41 additions and 23 deletions
|
@ -8,31 +8,49 @@ 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
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Forgejo Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
registry: ${{ env.FORGEJO_BASE_URL }}
|
||||||
- name: Build Go Binary
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
||||||
run: go mod tidy && go build -o loic
|
password: ${{ secrets.FORGEJO_PASSWORD }}
|
||||||
- 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
|
- name: Build and Push Docker Image
|
||||||
run: |
|
uses: docker/build-push-action@v5
|
||||||
echo "Building Docker image..."
|
with:
|
||||||
docker build -t loic:${{ github.sha }} . || { echo "Docker build failed"; exit 1; }
|
context: .
|
||||||
echo "Tagging image..."
|
push: true
|
||||||
docker tag loic:${{ github.sha }} ${{ env.FORGEJO_BASE_URL }}/{{ .Identity }}/loic:${{ github.sha }} || { echo "Docker tag failed"; exit 1; }
|
tags: ${{ env.FORGEJO_BASE_URL }}/${{ secrets.FORGEJO_USERNAME }}/loic:${{ github.sha }}
|
||||||
echo "Logging in to Forgejo registry..."
|
|
||||||
docker login -u {{ .Identity }} --password-stdin ${{ secret.PASSWORD }} || { echo "Docker login failed"; exit 1; }
|
# - name: Set up Go
|
||||||
echo "Pushing Docker image..."
|
# uses: actions/setup-go@v3
|
||||||
docker push ${{ env.FORGEJO_BASE_URL }}/{{ .Identity }}/loic:${{ github.sha }} || { echo "Docker push failed"; exit 1; }
|
# with:
|
||||||
echo "Done!"
|
# 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
|
# - name: Update Deployment Manifest
|
||||||
# run: |
|
# run: |
|
||||||
|
|
Loading…
Reference in a new issue