-
Notifications
You must be signed in to change notification settings - Fork 4
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
Tim Hofmann
committed
Jun 6, 2024
1 parent
4b95971
commit 211dcfe
Showing
2 changed files
with
67 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,38 +2,77 @@ | |
|
||
name: CI | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ master ] | ||
paths-ignore: | ||
- README.md | ||
pull_request: | ||
branches: [ master ] | ||
paths-ignore: | ||
- README.md | ||
release: | ||
types: [published] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
docker: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 # Checking out the repo | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Publish latest Docker image | ||
uses: VaultVulp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages | ||
image-name: PowerRqlite # Provide only Docker image name, tag will be automatically set to latest | ||
extract-git-tag: true | ||
dockerfile: PowerRqlite/Dockerfile | ||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
latest | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./src | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
release: | ||
name: Release | ||
strategy: | ||
|
@@ -52,20 +91,25 @@ jobs: | |
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- run: | | ||
git tag --list | ||
git describe --tags --abbrev=0 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v1 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 3.1.101 | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Build | ||
shell: bash | ||
run: | | ||
tag=$(git describe --tags --abbrev=0) | ||
release_name="PowerRqlite-$tag-${{ matrix.target }}" | ||
# Build everything | ||
dotnet publish PowerRqlite/PowerRqlite.csproj --self-contained --framework netcoreapp3.1 --runtime "${{ matrix.target }}" -c Release -o "$release_name" | ||
dotnet publish src/PowerRqlite.csproj --self-contained --framework net8.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" | ||
# Pack files | ||
if [ "${{ matrix.target }}" == "win-x64" ]; then | ||
# Pack to zip for Windows | ||
|
@@ -76,7 +120,7 @@ jobs: | |
# Delete output directory | ||
rm -r "$release_name" | ||
- name: Publish | ||
uses: softprops/action-gh-release@v1 | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: "PowerRqlite*" | ||
env: | ||
|