Skip to content

Crontab path correction #21

Crontab path correction

Crontab path correction #21

name: Build and release
on:
push:
tags:
- '*'
env:
IMAGE_NAME_API: ansible-manager-api
IMAGE_NAME_UI: ansible-manager-ui
jobs:
build-and-push:
name: Build and push
runs-on: ubuntu-latest
permissions: write-all
outputs:
tag: ${{ steps.get_tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Builder
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: get_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build and push API image
uses: docker/build-push-action@v2
with:
context: ./api
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME_API }}:${{ steps.get_tag.outputs.tag }}
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME_API }}:latest
- name: Build and push UI image
uses: docker/build-push-action@v2
with:
context: ./ui
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME_UI }}:${{ steps.get_tag.outputs.tag }}
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME_UI }}:latest
create-release:
name: Create release
needs: build-and-push
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get release notes
id: release_notes
run: |
RELEASE_NOTES=$(awk -v version=${{ needs.build-and-push.outputs.tag }} '/## \[/{flag=0} /## \['$version'\]/{flag=1} flag' CHANGELOG.md)
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.build-and-push.outputs.tag }}
release_name: Release ${{ needs.build-and-push.outputs.tag }}
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false