feature: add payment acl (#4) #6
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- develop | |
- 'hotfix/**' | |
- 'releases/**' | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: gabrielmqsouza/subscription-service | |
jobs: | |
tests: | |
name: Tests runner | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK@21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Run application tests | |
run: ./gradlew test | |
build: | |
name: Build runner | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK@21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | |
- name: Application build | |
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | |
with: | |
arguments: clean build -x test | |
- name: Set BUILD_TAG | |
run: | | |
echo BUILD_TAG=$(echo ${{ github.head_ref || github.ref_name }} | sed "s,/,_,g")-${{ github.run_number }} >> $GITHUB_ENV | |
- name: Print BUILD_TAG defined | |
run: | | |
echo "Branch ---> ${{ github.head_ref || github.ref_name }}" | |
echo "Run number ---> ${{ github.run_number }}" | |
echo "Tag ---> ${{ env.BUILD_TAG }}" | |
- name: Log in DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PWD }} | |
- name: Build & push docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
build-args: VERSION=${{ env.BUILD_TAG }} | |
tags: ${{ env.IMAGE_NAME }}:${{ env.BUILD_TAG }} |