Skip to content

Build go parser and release it #3

Build go parser and release it

Build go parser and release it #3

Workflow file for this run

name: Build and Publish package to GitHub Packages
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Set up Go
uses: actions/setup-go@v4
- 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: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: '~> v1'
args: release --snapshot
workdir: ./parser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ steps.version.outputs.version }}
body: |
Docker image: `ghcr.io/oviva-ag/ehealthid-relying-party:v${{ steps.version.outputs.version }}`
files: |
parser/dist/spicegen_Darwin_arm64.tar.gz
parser/dist/spicegen_Darwin_x86_64.tar.gz
parser/dist/spicegen_Linux_arm64.tar.gz
parser/dist/spicegen_Linux_i386.tar.gz
parser/dist/spicegen_Linux_x86_64.tar.gz
parser/dist/spicegen_darwin_arm64/spicegen
parser/dist/spicegen_linux_386/spicegen
parser/dist/spicegen_linux_amd64_v1/spicegen
parser/dist/spicegen_linux_arm64/spicegen
permissions:
contents: read
packages: write