Skip to content

Use GitHub actions for build #1

Use GitHub actions for build

Use GitHub actions for build #1

Workflow file for this run

# GitHub Actions documentation
# => https://docs.github.com/en/actions
name: Release
on:
push:
branches:
- master
jobs:
unit-test:
if: "!contains(github.event.head_commit.message, 'skip-ci')"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- run: |
./gradlew test
release:
if: "!contains(github.event.head_commit.message, 'skip-ci')"
needs: [ unit-test ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- name: Login to Heroku Docker Registry
uses: docker/login-action@v1
with:
password: ${{ secrets.HEROKU_REGISTRY_TOKEN }}
registry: registry.heroku.com
username: _
- name: 'Push image to Heroku registry'
run: ./gradlew dockerPushHerokuProduction
- name: Trigger release
shell: bash
env:
HEROKU_REGISTRY_TOKEN: ${{ secrets.HEROKU_REGISTRY_TOKEN }}
run: |
export IMAGE_ID=$(docker inspect registry.heroku.com/chucky/web --format={{.Id}})
curl -X PATCH \
https://api.heroku.com/apps/chucky/formation \
-H 'Accept: application/vnd.heroku+json; version=3.docker-releases' \
-H "Authorization: Bearer ${HEROKU_REGISTRY_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{\"updates\":[{\"type\":\"web\",\"docker_image\":\"${IMAGE_ID}\"}]}"