build(workflows): pushing needs login to registry #16
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: Run Tests in Container | |
on: | |
push: | |
branches-ignore: | |
- main | |
paths-ignore: | |
- CHANGELOG.md | |
- CONTRIBUTING.md | |
- LICENSE | |
- renovate.json | |
- docker-compose.yml | |
# - Dockerfile | |
workflow_dispatch: | |
# This should be consistent in the whole workflow | |
env: | |
YGGDRASIL_VERSION: 0.0.0 | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
container: | |
image: eclipse-temurin:21 | |
env: | |
TERM: dumb | |
ports: | |
- "8899:8080" | |
- "8900:8088" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- | |
name: yggdrasil is | |
run: echo ${{ env.YGGDRASIL_VERSION }} | |
- name: Run checks and tests | |
run: ./gradlew # disable checks for development | |
# run: ./gradlew check | |
# - name: Upload analysis to GitHub | |
# uses: actions/upload-artifact@v3 | |
# if: always() | |
# with: | |
# name: check-results | |
# path: | | |
# cartago/build/reports | |
# http/build/reports | |
# messages/build/reports | |
# store/build/reports | |
# utils/build/reports | |
# websub/build/reports | |
# build/reports | |
# if-no-files-found: error | |
- name: Upload app to GitHub | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: yggdrasil-${{ env.YGGDRASIL_VERSION }}-SNAPSHOT-all.jar | |
path: "build/libs/yggdrasil-${{ env.YGGDRASIL_VERSION }}-SNAPSHOT-all.jar" | |
if-no-files-found: error | |
- name: Upload conf to GitHub | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: conf | |
path: conf/docker_disk_config.json | |
if-no-files-found: error | |
build-container: | |
needs: build-app | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
# WARNING: https://stackoverflow.com/a/57877438 is suggesting to use '@master' | |
# however due to change from "master" to "main", "master" is outdated | |
uses: actions/download-artifact@v3 | |
id: download | |
with: | |
# Omitting name to download all artifacts | |
path: /opt/app/ | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: galess/ics-hsg-yggdrasil:${{ env.YGGDRASIL_VERSION }} |