Prepare for 2.1.3 release #55
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: Deploy | |
on: | |
push: | |
tags: | |
- 'micro-*.*.*' | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'true' | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: adopt | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Publish collector locally | |
run: | | |
git clone --branch 3.2.0 --depth 1 https://github.com/snowplow/stream-collector.git | |
cd stream-collector | |
sbt +publishLocal | |
- name: Run sbt | |
run: sbt test | |
- name: Get tag and tracker version information | |
id: version | |
run: | | |
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/*/} | |
echo "##[set-output name=MICRO_VERSION;]$(sbt version -Dsbt.log.noformat=true | perl -ne 'print "$1\n" if /info.*(\d+\.\d+\.\d+[^\r\n]*)/' | tail -n 1 | tr -d '\n')" | |
- name: Fail if version mismatch | |
if: ${{ steps.version.outputs.TAG_VERSION != format('micro-{0}', steps.version.outputs.MICRO_VERSION) }} | |
run: | | |
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project (${{ format('micro-{0}', steps.version.outputs.MICRO_VERSION) }})" | |
exit 1 | |
- name: Build the UI | |
working-directory: ui | |
env: | |
NEXT_PUBLIC_MICRO_HOSTNAME: '' | |
NEXT_PUBLIC_MUI_LICENSE_KEY: ${{ secrets.MUI_LICENSE }} | |
run: | | |
npm install | |
npm run build | |
- name: Build artifacts | |
run: sbt 'project micro' assembly | |
- name: Create GitHub release and attach artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
prerelease: true | |
name: Version ${{ steps.version.outputs.MICRO_VERSION }} | |
tag_name: ${{ steps.version.outputs.TAG_VERSION }} | |
files: | | |
target/scala-2.12/assembled_jars/snowplow-micro-${{ steps.version.outputs.MICRO_VERSION }}.jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Stage the Docker build | |
run: sbt "project micro" docker:stage | |
- name: Stage the Docker distroless build | |
run: sbt "project microDistroless" docker:stage | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: snowplow/snowplow-micro | |
tags: | | |
type=raw,value=latest,enable=${{ !contains(steps.version.outputs.MICRO_VERSION, 'rc') }} | |
type=raw,value=${{ steps.version.outputs.MICRO_VERSION }} | |
flavor: | | |
latest=false | |
- name: Docker metadata distroless | |
id: distroless-meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: snowplow/snowplow-micro | |
tags: | | |
type=raw,value=latest-distroless,enable=${{ !contains(steps.ver.outputs.MICRO_VERSION, 'rc') }} | |
type=raw,value=${{ steps.version.outputs.MICRO_VERSION }}-distroless | |
flavor: | | |
latest=false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build image | |
uses: docker/build-push-action@v2 | |
with: | |
context: target/docker/stage | |
file: target/docker/stage/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
- name: Build distroless image | |
uses: docker/build-push-action@v2 | |
with: | |
context: distroless/micro/target/docker/stage | |
file: distroless/micro/target/docker/stage/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ steps.distroless-meta.outputs.tags }} | |
push: true |