-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt GHA-Scala-Library-Release-Workflow (Scala Maven release only)
This change adopts `gha-scala-library-release-workflow` for publishing releases, replacing some of the work done in PR #229 and providing some improvements: * Automatic version-numbering based on automated compatibility-assessment by sbt-version-policy * Standardisation with the other projects across the Guardian that have also adopted the workflow * Reduced configuration (fewer sbt settings, and less workflow yaml) This specific commit only provides Scala Maven release, removing NPM release capability, but NPM release capability is returned in the next commit.
- Loading branch information
Showing
5 changed files
with
35 additions
and
249 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,91 +1,12 @@ | ||
name: Publish to Sonatype and NPM | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release_snapshot_sonatype: | ||
if: "github.event.release.prerelease" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
base: main #see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#pull-request-events | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: corretto | ||
java-version: 11 | ||
cache: sbt | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
# We cannot cache our environment, as it is dynamically generated by the plugin | ||
- name: Get tags | ||
run: git fetch --tags origin | ||
- name: Release pre-release version to Sonatype and NPM | ||
run: | | ||
VERSION=$(git describe --tags | cut -f2 -d"@") | ||
if [[ ${VERSION:0:1} == "v" ]] ; then | ||
VERSION=${VERSION:1} | ||
fi | ||
if [[ ${VERSION: -9} != "-SNAPSHOT" ]] ; then | ||
echo "Version must end in -SNAPSHOT. Adding -SNAPSHOT suffix" | ||
VERSION="$VERSION-SNAPSHOT" | ||
fi | ||
echo $PGP_SECRET | base64 --decode | gpg --batch --import | ||
export GPG_TTY=$(tty) | ||
echo "Releasing version $VERSION Sonatype as snapshot" | ||
# No need to support NPM releases – there's no direct analogue to a SNAPSHOT release. | ||
# Beta releases are classed as 'production' releases. | ||
sbt -J-Xss32M -DRELEASE_TYPE=snapshot "clean" "release cross release-version $VERSION with-defaults" | ||
env: | ||
# We use armour formatted files for keys, but we know the newlines they contain don't survive | ||
# passing through environment vars, so this secret should be an armour-formatted PGP key passed | ||
# through base64. | ||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
|
||
release_production_sonatype: | ||
#if: "!github.event.release.prerelease" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
base: main #see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#pull-request-events | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: corretto | ||
java-version: 11 | ||
cache: sbt | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
registry-url: https://registry.npmjs.org | ||
- name: Release Production to Sonatype | ||
run: | | ||
VERSION=$(git describe --tags | cut -f2 -d"@") | ||
if [[ ${VERSION:0:1} == "v" ]] ; then | ||
VERSION=${VERSION:1} | ||
fi | ||
if [[ ${VERSION: -9} == "-SNAPSHOT" ]] ; then | ||
echo "Version must NOT end in -SNAPSHOT." | ||
exit 1 | ||
fi | ||
echo $PGP_SECRET | base64 --decode | gpg --batch --import | ||
export GPG_TTY=$(tty) | ||
echo "Releasing version $VERSION Sonatype as production" | ||
yes | sbt -J-Xss32M "clean" "release cross release-version $VERSION with-defaults" "project typescript" "releaseNpm $VERSION" | ||
env: | ||
PGP_SECRET: ${{ secrets.PGP_SECRET }} | ||
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
release: | ||
uses: guardian/gha-scala-library-release-workflow/.github/workflows/reusable-release.yml@main | ||
permissions: { contents: write, pull-requests: write } | ||
secrets: | ||
SONATYPE_PASSWORD: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD }} | ||
PGP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ThisBuild / version := "18.0.1-SNAPSHOT" |