Container #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Container | |
on: | |
push: | |
tags: ["v*"] | |
jobs: | |
container: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata action | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=ref,event=branch | |
type=semver,pattern={{raw}} | |
type=sha,enable=true,priority=100,prefix=commit-,suffix=,format=short | |
- name: Publish images | |
uses: docker/build-push-action@v5 | |
with: | |
context: Net.Vatprc.Uniapi | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
needs: [container] | |
env: | |
RELEASE_VERSION: ${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: "xfoxfu/infra" | |
token: ${{ secrets.GH_TOKEN_INFRA }} | |
- name: Install jq and moreutils (sponge) | |
run: | | |
sudo apt-get update | |
sudo apt-get install jq moreutils | |
- run: | | |
jq '.["uniapi"]="${{ github.ref_name }}"' release.json | sponge release.json | |
- name: Push update | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name 'VATPRC GitOps' | |
git add . | |
git commit --message 'feat: upgrade uniapi to ${{ github.ref_name }}' | |
git push -u origin HEAD:main |