-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): github container build & releasing
Co-authored-by: kuhball <[email protected]>
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Setup | ||
run: make setup | ||
|
||
- name: Run tests | ||
run: make unit | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Setup | ||
run: make setup | ||
|
||
- name: Run pre-commit | ||
run: make pre-commit-all | ||
env: | ||
SKIP: "no-commit-to-branch" | ||
container: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
- pre-commit | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
ghcr.io/akquinet/powerdns-api-proxy | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- name: Login to GHCR | ||
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'main') | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push master Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'main') }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
semantic-release: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'main' | ||
needs: | ||
- container | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v3 |