Skip to content

Fix changelog

Fix changelog #12

name: Build and Publish
on:
push:
branches:
- master
- dev
tags:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --tags --force
- name: Metadata
run: echo "IS_RELEASE=${{ startsWith(github.ref, 'refs/tags/') }}" >> $GITHUB_ENV
- name: Environment
run: |
echo "VERSION=$(python build/print_version.py ${{ github.run_number }} ${{ env.IS_RELEASE }} false)" >> $GITHUB_ENV
echo "$(python build/print_solution.py)" >> $GITHUB_ENV
- name: Extract annotation tag
if: ${{ env.IS_RELEASE == 'true' }}
run: python build/create_tag_body.py
- name: Create Docker Output Folder
run: mkdir --parent artifacts/images
- name: Docker Setup
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
run: dotnet publish -c release -o app /p:Version=${{ env.VERSION }} src/Minimail/Minimail.csproj
- name: Docker Build
run: |
docker build -t ghcr.io/apollo3zehn/minimail:${{ env.VERSION }} .
docker save --output artifacts/images/minimail_image.tar ghcr.io/apollo3zehn/minimail:${{ env.VERSION }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts/images/
outputs:
is_release: ${{ env.IS_RELEASE }}
version: ${{ env.VERSION }}
publish_dev:
needs: build
name: Publish (dev)
runs-on: ubuntu-latest
if: ${{ needs.build.outputs.is_release != 'true' }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts
- name: Docker Load Image
run: docker load --input artifacts/minimail_image.tar
- name: Docker Login (Github Container Registry)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Push
run: docker push ghcr.io/apollo3zehn/minimail:${{ needs.build.outputs.version }}
publish_release:
needs: build
name: Publish (release)
runs-on: ubuntu-latest
if: ${{ needs.build.outputs.is_release == 'true' }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts
- name: GitHub Release Artifacts
uses: softprops/action-gh-release@v1
with:
body_path: artifacts/tag_body.txt
- name: Docker Load Image
run: docker load --input artifacts/minimail_image.tar
- name: Docker Login (Docker Hub)
uses: docker/login-action@v1
with:
username: apollo3zehn
password: ${{ secrets.DOCKER_API_KEY }}
- name: Docker Push
run: docker push apollo3zehn/minimail:${{ needs.build.outputs.version }}