ARC-1986: Setup 'central' Server Credentials #23
Workflow file for this run
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: Build and Publish package to GitHub Packages | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
server-id: central | |
server-username: CENTRAL_USERNAME | |
server-password: CENTRAL_PASSWORD | |
cache: 'maven' | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
- name: Get version | |
id: version | |
run: | | |
echo "parsing version from ref '$GITHUB_REF'" | |
VERSION=$(echo "$GITHUB_REF" | sed -e "s|refs/tags/||g" | sed -E 's/v?([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z]+(\.[0-9]+)?)?/\1.\2.\3\4/g') | |
echo "version: '$VERSION'" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Update Version | |
run: | | |
echo "updating version to '$VERSION'" | |
mvn -B versions:set "-DnewVersion=$VERSION" | |
- name: Make AST preprocessor | |
working-directory: parser | |
run: make build | |
- name: Publish package | |
run: | | |
echo -n "$MAVEN_GPG_KEY" | gpg --import --batch | |
mvn --batch-mode -Prelease deploy | |
env: | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |