patch: issue/1 entrypoint.sh #30
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: Semantic-Version | |
on: | |
push: | |
branches: | |
#- main | |
- feat/issue/1 | |
pull_request: | |
branches: [ main ] | |
env: | |
REPO_USER: 'jpradoar' | |
REPO_APP: 'ga-semanticversion' | |
BUILD_CONTEXT: './' | |
jobs: | |
Semantic-Version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout del repositorio | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: jpradoar | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Show last version of docker-hub image | |
id: get_last_version | |
run: | | |
LastVersion=$(curl -s "https://hub.docker.com/v2/repositories/${{ env.REPO_USER }}/${{ env.REPO_APP }}/tags/?page_size=2" | jq -r '.results[].name'|sort -M|grep -v latest|tail -1) | |
echo "LAST_VERSION=$LastVersion " >> "$GITHUB_OUTPUT" | |
- name: Generate new version with local file | |
id: nversion | |
uses: jpradoar/[email protected] | |
with: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
VERSION: ${{ steps.get_last_version.outputs.LAST_VERSION }} | |
- name: Show new version | |
run: echo "New version ${{ steps.nversion.outputs.NEW_VERSION }}" | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ env.BUILD_CONTEXT }} | |
push: true | |
tags: jpradoar/${{ env.REPO_APP }}:${{ steps.nversion.outputs.NEW_VERSION }} |