Add tag for agent-develop branch #81
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: Add tag for agent-develop branch | |
run-name: Add tag for agent-develop branch | |
on: | |
push: | |
branches: | |
- agent-develop | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
update-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Git status | |
run: git status | |
- run: | | |
echo "commit_part=${GITHUB_SHA:0:7}" >> $GITHUB_ENV | |
- run: | | |
git config --global user.email "${{ github.event.commits[0].author.email }}" | |
git config --global user.name "${{ github.event.commits[0].author.name }}" | |
git tag -d agent-dev | |
git push --delete origin agent-dev | |
git tag agent-dev ${{ env.commit_part }} | |
git push origin agent-dev | |
build-container: | |
runs-on: ubuntu-latest | |
name: Build and Push Docker Image | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:agent-dev | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |