add commandbox install #15
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: Release | |
on: | |
push: | |
branches: | |
- master | |
- development | |
tags: | |
- v* | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Setup Java | |
uses: actions/setup-java@v3.9.0 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
- name: Setup CommandBox | |
uses: Ortus-Solutions/setup-commandbox@v2.0.1 | |
- name: Setup Environment Variables For Build Process | |
id: current_version | |
run: | | |
box install stachebox --production | |
echo "VERSION=`cat modules/stachebox/box.json | jq '.version' -r`" >> $GITHUB_ENV | |
- name: Setup Builds | |
id: setup | |
env: | |
DOCKER_IMAGE: ortussolutions/stachebox | |
run: | | |
# Tag Builds | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
BUILD_IMAGE_TAG="${GITHUB_REF#refs/tags/v}" | |
elif [[ $GITHUB_REF == 'refs/heads/development' ]]; then | |
# Snapshot builds | |
BUILD_IMAGE_TAG=snapshot | |
VERSION_TAG = snapshot-${{ env.VERSION }} | |
else | |
BUILD_IMAGE_TAG=latest | |
VERSION_TAG=${{ env.VERSION }} | |
fi | |
TAGS="${DOCKER_IMAGE}:${BUILD_IMAGE_TAG},${DOCKER_IMAGE}:${VERSION_TAG}" | |
# Set output parameters. | |
echo "IMAGE_TAG=${TAGS}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: DockerHub Login | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Stachebox Image | |
uses: docker/build-push-action@v4 | |
env: | |
DOCKER_BUILDKIT: 1 | |
with: | |
provenance: false | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ${{ env.IMAGE_TAG }} |