0.6.1 #34
Workflow file for this run
This file contains hidden or 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: Publish | |
| permissions: | |
| contents: write | |
| packages: write | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| version: | |
| runs-on: ubuntu-latest | |
| name: Bump version | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Get version | |
| run: | | |
| tag=${{ github.event.release.tag_name }} | |
| echo "VERSION=${tag#v}" >> $GITHUB_ENV | |
| - name: Bump build version | |
| id: bump | |
| uses: vers-one/dotnet-project-version-updater@v1.3 | |
| with: | |
| file: "Server.csproj" | |
| version: ${{ env.VERSION }} | |
| - run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | |
| git add . | |
| git commit -m "Bump project version to ${{ steps.bump.outputs.newVersion }}" | |
| git push | |
| binary-release: | |
| needs: version | |
| name: Binary Release | |
| strategy: | |
| matrix: | |
| kind: ['linux', 'windows', 'macOS'] | |
| include: | |
| - kind: linux | |
| os: ubuntu-latest | |
| target: linux-x64 | |
| - kind: windows | |
| os: windows-latest | |
| target: win-x64 | |
| - kind: macOS | |
| os: macos-latest | |
| target: osx-x64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8 | |
| - name: Build | |
| shell: bash | |
| run: | | |
| tag=${{ github.event.release.tag_name }} | |
| release_name="LighthouseNotes-Server-$tag-${{ matrix.target }}" | |
| # Build everything | |
| dotnet publish Server.csproj --framework net7.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true --self-contained true | |
| # Pack files | |
| if [ "${{ matrix.target }}" == "win-x64" ]; then | |
| # Pack to zip for Windows | |
| 7z a -tzip "${release_name}.zip" "./${release_name}/*" | |
| else | |
| tar czvf "${release_name}.tar.gz" "$release_name" | |
| fi | |
| # Delete output directory | |
| rm -r "$release_name" | |
| - name: Publish | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: "LighthouseNotes-Server-*" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker-release: | |
| needs: version | |
| name: Docker Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |