[build] Replace depracated publish target with GitHub Packages #446
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: CI | |
on: | |
push: | |
branches: [ '**' ] | |
tags: [ '**' ] | |
pull_request: | |
branches: [ '**' ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: coursier/cache-action@v6 | |
- uses: coursier/[email protected] | |
with: | |
jvm: zulu:17 | |
- name: Check format | |
run: ./millw __.checkFormat | |
- name: Compile all | |
run: ./millw __.compile | |
- name: Scalafix check | |
run: ./millw __.fix --check | |
- name: Run tests | |
run: ./millw __.test | |
- name: Setup GPG secrets for publish | |
run: | | |
gpg --version | |
cat <(echo "${{ secrets.GPG_SECRET_KEY }}") | base64 --decode | gpg --batch --import | |
- name: Publish to Github packages | |
if: github.event_name != 'pull_request' && github.event_name == 'push' && ((startsWith(github.ref, 'refs/tags/')) || github.ref == 'refs/heads/main') | |
run: | | |
./millw mill.scalalib.PublishModule/publishAll \ | |
__.publishArtifacts \ | |
--sonatypeCreds '${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}' \ | |
--stagingRelease false \ | |
--sonatypeUri "https://maven.pkg.github.com/${{ github.repository }}" \ | |
--gpgArgs --batch,--yes,-a,-b | |
publish-notes: | |
name: Publish release notes | |
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/')) | |
needs: [ build ] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Extract version from commit message | |
run: | | |
version=${GITHUB_REF#refs/*/} | |
echo "VERSION=$version" >> $GITHUB_ENV | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
- name: Publish release notes | |
uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yaml | |
publish: true | |
name: "v${{ env.VERSION }}" | |
tag: "${{ env.VERSION }}" | |
version: "v${{ env.VERSION }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |