This commit is contained in:
76
.github/workflows/docker-cicd-dev.yml
vendored
Normal file
76
.github/workflows/docker-cicd-dev.yml
vendored
Normal file
@@ -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 }}
|
||||
36
.github/workflows/docker-cicd-gitea-dev.yml
vendored
Normal file
36
.github/workflows/docker-cicd-gitea-dev.yml
vendored
Normal file
@@ -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
|
||||
71
.github/workflows/docker-cicd-prod.yml
vendored
Executable file
71
.github/workflows/docker-cicd-prod.yml
vendored
Executable file
@@ -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 }}
|
||||
Reference in New Issue
Block a user