Merge pull request #1105 from paivagustavo/comments-overrides #256
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: Test and maybe create a new release | |
| on: | |
| push: | |
| branches: [master, v3] | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/reusable-testing.yml | |
| tag: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| outputs: | |
| tag_result: ${{ steps.tag.outputs.tag_result }} | |
| requested_version: ${{ steps.tag.outputs.requested_version }} | |
| previous_version: ${{ steps.tag.outputs.previous_version }} | |
| steps: | |
| - run: sudo apt update && sudo apt install -y git && git --version | |
| - uses: actions/checkout@v2 | |
| with: | |
| # We need entire history of tags | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: ./tools/go.mod | |
| check-latest: true | |
| cache-dependency-path: "**/*.sum" | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run tagging commands | |
| id: tag | |
| run: | | |
| set +e | |
| task -x tag 1>/tmp/versions.txt | |
| tag_result="$?" | |
| printf "versions: $(cat /tmp/versions.txt)\n" | |
| echo "requested_version=$(cut -d',' -f 1 /tmp/versions.txt)" >> $GITHUB_OUTPUT | |
| echo "previous_version=$(cut -d',' -f 2 /tmp/versions.txt)" >> $GITHUB_OUTPUT | |
| echo "tag_result=$tag_result" >> $GITHUB_OUTPUT | |
| # The range between 8 and 63 inclusive is reserved for custom | |
| # error codes that contain specific meaning. | |
| if [ $tag_result -lt 8 -o $tag_result -gt 63 ]; then | |
| exit $tag_result | |
| fi | |
| exit 0 | |
| - name: Push tags | |
| run: task tag.push | |
| if: steps.tag.outputs.tag_result == 0 | |
| release: | |
| needs: tag | |
| if: needs.tag.outputs.tag_result == 0 | |
| uses: ./.github/workflows/release.yml | |
| secrets: inherit | |
| with: | |
| tag: ${{ needs.tag.outputs.requested_version }} |