Initial commit with service and CI/CD #9
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: Publish Image | |
on: | |
push: | |
branches: [main, test/*] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
# Need to do this at the start to be able to use test containers | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Gradle build | |
run: ./gradlew build | |
shell: bash | |
- name: Setup Image Name for Env | |
id: image-env-name | |
uses: ./.github/actions/image-env-name | |
with: | |
base-image-name: snippet-asset-service | |
main-branch-name: "main" | |
- name: Setup Branch Name for Tag | |
id: tag-branch-name | |
uses: ./.github/actions/tag-branch-name | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: austral-ingsis | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to GitHub Container Registry | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/austral-ingsis/${{ steps.image-env-name.outputs.image_name }}:${{ steps.tag-branch-name.outputs.tag }} | |
ghcr.io/austral-ingsis/${{ steps.image-env-name.outputs.image_name }} |