Skip to content

[ADD] debug

[ADD] debug #28

on:
pull_request:
paths:
- src/**
- Cargo.lock
- Cargo.toml
- Dockerfile
types:
- closed
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
- uses: actions/checkout@v4
- name: Tag and prepare release
id: tag_and_prepare_release
uses: K-Phoen/semver-release-action@master
with:
release_branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build variables
id: build_var
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=BUILD_DATE::$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo ::set-output name=PROJECT_URL::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
echo ::set-output name=VCS_REF::$GITHUB_SHA
- name: Build and push Docker images
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
build-args: |
VERSION=${{ steps.tag_and_prepare_release.outputs.tag }}
VCS_REF=${{ steps.build_var.outputs.VCS_REF }}
BUILD_DATE=${{ steps.build_var.outputs.BUILD_DATE }}
PROJECT_URL=${{ steps.build_var.outputs.PROJECT_URL }}
tags: |
w6dio/sirius:${{ steps.tag_and_prepare_release.outputs.tag }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Upload release notes
uses: Roang-zero1/github-create-release-action@v3
with:
created_tag: ${{ steps.tag_and_prepare_release.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
tag: ${{ steps.tag_and_prepare_release.outputs.tag }}
update-kustomize-image:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'deploy'
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: setup kustomize
uses: imranismail/setup-kustomize@v2
- name: update deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ${GITHUB_WORKSPACE}/deploy/base
kustomize edit set image w6dio/sirius=w6dio/sirius:${{needs.build.outputs.tag}}
git add .
git commit -m "chore: set image tag to ${{needs.build.outputs.tag}}"
git push