Skip to content

Merge pull request #230 from Shield-Cyber/revert-227-dev #43

Merge pull request #230 from Shield-Cyber/revert-227-dev

Merge pull request #230 from Shield-Cyber/revert-227-dev #43

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- app/**
- test/**
- compose.yml
- install.sh
- example.env
- .github/workflows/release.yml
# Comment literaly to make it run automatically and correctly I hope...
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# pytest:
# name: Pytest
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.10.x", "3.11.x"]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install Python Dependencies
# run: |
# pip3 install -r app/requirements.txt
# - name: Install Testing Dependecies
# run: |
# pip3 install pytest httpx
# - name: Run PyTest
# run: |
# pytest
source:
name: Source
# needs: pytest
runs-on: ubuntu-latest
outputs:
v_tag: ${{steps.version.outputs.version_tag}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Version Tag
id: version
uses: paulhatch/[email protected]
with:
tag_prefix: ''
major_pattern: "Major"
minor_pattern: "Minor"
version_format: "${major}.${minor}.${patch}-prerelease${increment}"
change_path: "app"
# search_commit_body: true
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: true
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
include: app/Dockerfile
find: ENV VERSION=\d{1,3}\.\d{1,3}\.\d{1,3}
replace: ENV VERSION=${{ steps.version.outputs.version_tag }}
regex: true
- name: Commit & Push Version Change
uses: actions-js/push@master
with:
message: Auto Version Bump
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.version.outputs.version_tag }}
name: Version ${{ steps.version.outputs.version_tag }}
generateReleaseNotes: true
# draft: true
# prerelease: true
makeLatest: true
updateOnlyUnreleased: false
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
container:
name: Container
needs: source
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
pull-requests: write
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Login to Registry
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Setup Docker Buildx
uses: docker/[email protected]
-
name: Extract Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ needs.source.outputs.v_tag }}
latest
flavor: |
latest=auto
-
name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v4
if: ${{ github.event_name != 'pull_request' }}
with:
platforms: linux/amd64,linux/arm64
context: ./app
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max