update readme #24
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 | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-push: | |
if: ${{ !contains(github.event.head_commit.message, 'Update tag in values helm') }} | |
name: "Build and Push" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22.5" | |
- name: Run tests | |
run: go test | |
- name: Generate SHA | |
id: generate_sha | |
run: | | |
SHA=$(echo $GITHUB_SHA | head -c7) | |
echo "sha=$SHA" >> $GITHUB_OUTPUT | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: | | |
sandrolax/api-journey:${{ steps.generate_sha.outputs.sha }} | |
sandrolax/api-journey:latest | |
# Maneira manual sem action | |
# - name: Build docker image | |
# run: docker build -t sandrolax/api-journey:${{ steps.generate_sha.outputs.sha }} . | |
# - name: Push to registry | |
# run: | | |
# docker push sandrolax/api-journey:${{ steps.generate_sha.outputs.sha }} | |
# docker tag sandrolax/api-journey:${{ steps.generate_sha.outputs.sha }} sandrolax/api-journey:latest | |
# docker push sandrolax/api-journey:latest | |
- name: Update image helm | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
#Comentar para não criar uma PR ao invés de só commitar na master | |
branch: release | |
targeBranch: master | |
createPR: true | |
valueFile: "devops/k8s-helm/values.yaml" | |
propertyPath: "image.tag" | |
value: ${{ steps.generate_sha.outputs.sha }} | |
commitChange: true | |
message: "[skip ci] Update tag in values helm" |