CI #3
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: CI | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/**' | |
workflow_dispatch: | |
jobs: | |
build-push: | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout code. | |
uses: actions/checkout@v4 | |
- name: Setup QEMU. | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup docker buildx. | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to container registry. | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and push docker image. | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: mangohabanero/be:latest, mangohabanero/be:${{ github.sha }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build-push | |
environment: production | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout code. | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # python-sematic-release needs full history to determine whether to maker a release. | |
- name: Set up python. | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.3' | |
- name: Install poetry. | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV | |
- name: Install dependencies. | |
run: | | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Python semantic release. | |
uses: python-semantic-release/python-semantic-release@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |