Add the license #28
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: ozma-report-generator | |
on: push | |
jobs: | |
build: | |
name: Build | |
permissions: | |
contents: read | |
id-token: write | |
attestations: write | |
outputs: | |
artifact-id: ${{ steps.upload.outputs.artifact-id }} | |
artifact-url: ${{ steps.upload.outputs.artifact-url }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
cache: true | |
cache-dependency-path: | | |
./OzmaReportGenerator/packages.lock.json | |
- name: Restore | |
run: | | |
dotnet restore --locked-mode -r linux-x64 | |
- name: Check formatting | |
run: | | |
dotnet format --no-restore --verify-no-changes | |
- name: Build Release | |
run: | | |
dotnet publish --no-restore -o out -c Release -r linux-x64 OzmaReportGenerator/OzmaReportGenerator.csproj | |
- name: Upload Artifacts | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ozma-report-generator | |
path: ./out | |
if-no-files-found: error | |
# - name: Attest | |
# uses: actions/attest-build-provenance@v1 | |
# with: | |
# subject-path: out/** | |
publish-docker: | |
name: Publish Docker Image | |
if: github.repository == 'ozma-io/ozma-report-generator' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | |
needs: build | |
permissions: | |
contents: read | |
id-token: write | |
attestations: write | |
outputs: | |
digest: ${{ steps.push.outputs.digest }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ozmaio/ozma-report-generator | |
- name: Download Release | |
uses: actions/download-artifact@v4 | |
with: | |
name: ozma-report-generator | |
path: ./out | |
- name: Fix permissions | |
run: | |
chmod +x out/OzmaReportGenerator | |
- name: Build a Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# - name: Attest Docker Image | |
# uses: actions/attest-build-provenance@v1 | |
# with: | |
# subject-name: ozmaio/ozma-report-generator | |
# subject-digest: ${{ steps.push.outputs.digest }} | |
# push-to-registry: true | |
publish-release: | |
name: Publish Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
permissions: | |
contents: write | |
id-token: write | |
attestations: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download Release | |
uses: actions/download-artifact@v4 | |
with: | |
name: ozma-report-generator | |
path: ./out | |
- name: Make a Release Archive | |
env: | |
REF: ${{ github.ref }} | |
run: | | |
rel_version=${REF#refs/tags/v} | |
curr_version=$(yq -p xml -o json -r '.Project.PropertyGroup.Version' OzmaReportGenerator/OzmaReportGenerator.csproj) | |
if [ "$rel_version" != "$curr_version" ]; then | |
echo "Tag doesn't correspond to the project version. Expected '$rel_version', got '$curr_version'." >&2 | |
exit 1 | |
fi | |
echo "Publishing version: $rel_version" | |
chmod +x out/OzmaReportGenerator | |
cp --reflink=auto -ar out "ozma-report-generator-$rel_version" | |
tar -cJf "ozma-report-generator-$rel_version.tar.xz" "ozma-report-generator-$rel_version" | |
- name: Publish release | |
uses: ghalactic/github-release-from-tag@v5 | |
with: | |
assets: | | |
- path: ./ozma-report-generator-*.tar.xz | |
label: Linux (x64) |