From 4bb88ceaaf9e75edf257c50e3e2691b7340af562 Mon Sep 17 00:00:00 2001 From: mcbtaguiad Date: Mon, 19 Jan 2026 22:49:52 +0800 Subject: [PATCH] test-final-ult --- .github/workflows/docker-cicd-dev.yml | 76 +++++++++++++++++++++ .github/workflows/docker-cicd-gitea-dev.yml | 36 ++++++++++ .github/workflows/docker-cicd-prod.yml | 71 +++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 .github/workflows/docker-cicd-dev.yml create mode 100644 .github/workflows/docker-cicd-gitea-dev.yml create mode 100755 .github/workflows/docker-cicd-prod.yml diff --git a/.github/workflows/docker-cicd-dev.yml b/.github/workflows/docker-cicd-dev.yml new file mode 100644 index 0000000..83cf09c --- /dev/null +++ b/.github/workflows/docker-cicd-dev.yml @@ -0,0 +1,76 @@ +name: Build-Push-Deploy-Prod + +# on: +# push: +# branches: [ "main" ] +# pull_request: +# branches: [ "main" ] + +# on: +# workflow_dispatch: + +on: + push: + branches: [ "dev" ] + # Publish semver tags as releases. + tags: [ 'v*' ] + pull_request: + branches: [ "dev" ] + types: [closed] + + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + + build: + # if: github.event.pull_request.merged == true + + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Change base url + shell: bash + run: | + sed -i 's/https:\/\/marktaguiad.dev/https:\/\/dev.marktaguiad.dev/g' app/config.toml + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + type=semver,pattern={{version}} + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/docker-cicd-gitea-dev.yml b/.github/workflows/docker-cicd-gitea-dev.yml new file mode 100644 index 0000000..4103f2b --- /dev/null +++ b/.github/workflows/docker-cicd-gitea-dev.yml @@ -0,0 +1,36 @@ +name: Build-Push-Deploy-Prod + +# on: +# push: +# branches: [ "main" ] +# pull_request: +# branches: [ "main" ] + +# on: +# workflow_dispatch: + +on: + push: + branches: [ "gitea-dev" ] + # Publish semver tags as releases. + # what? + tags: [ 'v*' ] + pull_request: + branches: [ "gitea-dev" ] + types: [closed] + + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Push to Gitea + run: | + git remote add gitea https://${{ secrets.GITEA_TOKEN }}@gitea.marktaguiad.dev/mcbtaguiad/marktaguiad.dev.git + git push gitea --all + git push gitea --tags \ No newline at end of file diff --git a/.github/workflows/docker-cicd-prod.yml b/.github/workflows/docker-cicd-prod.yml new file mode 100755 index 0000000..5fd2016 --- /dev/null +++ b/.github/workflows/docker-cicd-prod.yml @@ -0,0 +1,71 @@ +name: Build-Push-Deploy-Dev + +# on: +# push: +# branches: [ "main" ] +# pull_request: +# branches: [ "main" ] + +# on: +# workflow_dispatch: + +on: + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*' ] + pull_request: + branches: [ "main" ] + types: [closed] + + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + + build: + # if: github.event.pull_request.merged == true + + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + type=semver,pattern={{version}} + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file