Merge pull request #58 from asaasdev/DVT701 #76
This file contains hidden or 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: release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - labeled | |
| jobs: | |
| release: | |
| if: github.event.action != 'labeled' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| # Bump version on merging Pull Requests with specific labels. | |
| # (bump:major,bump:minor,bump:patch) | |
| - id: bumpr | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| uses: haya14busa/action-bumpr@v1 | |
| # Update corresponding major and minor tag. | |
| # e.g. Update v1 and v1.2 when releasing v1.2.3 | |
| - uses: haya14busa/[email protected] | |
| if: "!steps.bumpr.outputs.skip" | |
| with: | |
| tag: ${{ steps.bumpr.outputs.next_version }} | |
| # Get tag name. | |
| - id: tag | |
| uses: haya14busa/action-cond@v1 | |
| with: | |
| cond: "${{ startsWith(github.ref, 'refs/tags/') }}" | |
| if_true: ${{ github.ref }} | |
| if_false: ${{ steps.bumpr.outputs.next_version }} | |
| # Create release. | |
| - uses: actions/create-release@v1 | |
| if: "steps.tag.outputs.value != ''" | |
| env: | |
| # This token is provided by Actions, you do not need to create your own token | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag.outputs.value }} | |
| release_name: Release ${{ steps.tag.outputs.value }} | |
| body: ${{ steps.bumpr.outputs.message }} | |
| draft: false | |
| prerelease: false | |
| publish: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions-ecosystem/action-get-latest-tag@v1 | |
| id: get-latest-tag | |
| with: | |
| semver_only: true | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v3 | |
| with: | |
| push: true | |
| tags: | | |
| asaasdev/codenarc:${{ steps.get-latest-tag.outputs.tag }} | |
| asaasdev/codenarc:latest | |
| - name: Image digest | |
| run: echo ${{ steps.docker_build.outputs.digest }} | |
| release-check: | |
| if: github.event.action == 'labeled' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Post bumpr status comment | |
| uses: haya14busa/action-bumpr@v1 |