Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Hofmann committed Jun 6, 2024
1 parent 4b95971 commit 211dcfe
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 90 deletions.
67 changes: 0 additions & 67 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

90 changes: 67 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 211dcfe

Please sign in to comment.