Add tag for agent-develop branch #92
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: | |
- main-dev | |
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 }}" | |
if git tag --list | grep "^main-develop";then git tag -d main-develop;fi | |
git push --delete origin main-dev | |
git tag main-develop ${{ env.commit_part }} | |
git push origin main-develop | |
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 }}:main-dev | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |