This repository was archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89decc0
commit 6004031
Showing
2 changed files
with
87 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea/ | ||
.git/ | ||
.gitignore | ||
/data | ||
/data | ||
.github |
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,85 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
tags: [ 'v*.*.*' ] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository (with submodules) | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Extract semver | ||
id: get_version | ||
uses: battila7/get-version-action@v2 | ||
|
||
# Lowercase image name, as mixed case is not allowed while caching | ||
- name: lowercase IMAGE_NAME | ||
run: | | ||
echo "IMAGE_NAME_LOWER=${IMAGE_NAME,,}" >>${GITHUB_ENV} | ||
env: | ||
IMAGE_NAME: '${{ env.IMAGE_NAME }}' | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
flavor: | | ||
latest=${{ !github.event.release.prerelease }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
|
||
# Build and push Docker image with Buildx | ||
# https://github.com/docker/build-push-action | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:latest | ||
cache-to: type=inline | ||
build-args: | | ||
API_VERSION=${{steps.get_version.outputs.version-without-v}} | ||
- name: Generate SBOM | ||
uses: anchore/[email protected] | ||
with: | ||
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:${{steps.get_version.outputs.version-without-v}} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
format: cyclonedx-json |