Compare commits
9 Commits
0e831b0fb5
...
802e6498c8
Author | SHA1 | Date | |
---|---|---|---|
802e6498c8 | |||
5cae75ce26 | |||
1f60d18316 | |||
4116fc71ef | |||
2b75a2f97a | |||
7a979cd1a0 | |||
3e7652eeb2 | |||
14ad5aba68 | |||
0eb6f1d6e7 |
45
.github/workflows/docker-publish.yml
vendored
45
.github/workflows/docker-publish.yml
vendored
@ -16,7 +16,7 @@ on:
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: ghcr.io
|
||||
REGISTRY2: git.suyiiyii.top
|
||||
REGISTRY2: registry.cn-shenzhen.aliyuncs.com
|
||||
# github.repository as <account>/<repo>
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
@ -63,6 +63,13 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get current date and commit ID
|
||||
id: vars
|
||||
run: |
|
||||
echo "DATE=$(date +'%y%m%d')" >> $GITHUB_ENV
|
||||
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
- name: Extract Docker metadata
|
||||
@ -70,6 +77,7 @@ jobs:
|
||||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.service }}
|
||||
tags: ${{ env.DATE }}-${{ env.COMMIT }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
@ -92,8 +100,8 @@ jobs:
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY2 }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITEATOKEN }}
|
||||
username: ${{ secrets.ALI_REG_USERNAME }}
|
||||
password: ${{ secrets.ALI_REG_PASSWORD }}
|
||||
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
@ -102,6 +110,7 @@ jobs:
|
||||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
|
||||
with:
|
||||
images: ${{ env.REGISTRY2 }}/${{ env.IMAGE_NAME }}-${{ matrix.service }}
|
||||
tags: ${{ env.DATE }}-${{ env.COMMIT }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
@ -130,3 +139,33 @@ jobs:
|
||||
# This step uses the identity token to provision an ephemeral certificate
|
||||
# against the sigstore community Fulcio instance.
|
||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|
||||
outputs:
|
||||
version: ${{ steps.meta.outputs.version }}
|
||||
|
||||
update-manifest:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ "build" ]
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout manifest
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: manifest
|
||||
token: ${{ secrets.GITHUBTOKEN }}
|
||||
- name: Update manifest
|
||||
if: github.event_name == 'push'
|
||||
uses: mikefarah/yq@master
|
||||
with:
|
||||
cmd: yq eval '.tag = "${{ needs.build.outputs.version }}"' -i values.yaml
|
||||
- name: Git Auto Commit
|
||||
if: github.event_name == 'push'
|
||||
uses: stefanzweifel/git-auto-commit-action@v5.0.1
|
||||
with:
|
||||
commit_message: "Update deployment image tag to ${{ needs.build.outputs.version }}"
|
||||
branch: manifest
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user