Remove redis dependency #8
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: Release | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
IMAGE_NAME: lindseybot/bot | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Fetch version | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo VERSION=$VERSION | |
echo "RELEASE=$VERSION" >> $GITHUB_ENV | |
echo "release=$VERSION" > ./bot/src/main/resources/sentry.properties | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Build with gradle | |
run: ./gradlew build | |
env: | |
USERNAME: ${{ github.actor }} | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Build | |
run: docker build ./bot/ --file ./bot/Dockerfile --tag $IMAGE_NAME | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
run: | | |
IMAGE_ID=ghcr.io/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
echo "Tagging image as $IMAGE_ID:$RELEASE" | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker tag $IMAGE_NAME $IMAGE_ID:$RELEASE | |
echo "Pushing images" | |
docker push $IMAGE_ID:$RELEASE | |
docker push $IMAGE_ID:latest | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
version: ${{ env.RELEASE }} |