This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Merge pull request #199 from v1Flows/develop #6
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 action-plugins - collect_data | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - "action-plugins/collect_data/**" | |
| jobs: | |
| build-and-release: | |
| name: Build and Release collect_data | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Read Plugin Version | |
| id: read_version | |
| working-directory: action-plugins/collect_data | |
| run: | | |
| VERSION=$(cat .version) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if Tag or Release Exists | |
| id: check-tag-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| run: | | |
| TAG_EXISTS=$(git ls-remote --tags origin | grep "refs/tags/collect_data-v${{ steps.read_version.outputs.version }}" || true) | |
| RELEASE_EXISTS=$(gh release list --repo ${{ github.repository }} | grep "Release collect_data v${{ steps.read_version.outputs.version }}" || true) | |
| if [ -n "$TAG_EXISTS" ] || [ -n "$RELEASE_EXISTS" ]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: '1.24' | |
| - name: Build Plugin | |
| if: steps.check-tag-release.outputs.skip == 'false' | |
| working-directory: action-plugins/collect_data | |
| run: | | |
| GOOS=darwin GOARCH=amd64 go build -o collect_data-v${{ steps.read_version.outputs.version }}-darwin-amd64 | |
| GOOS=darwin GOARCH=arm64 go build -o collect_data-v${{ steps.read_version.outputs.version }}-darwin-arm64 | |
| GOOS=linux GOARCH=amd64 go build -o collect_data-v${{ steps.read_version.outputs.version }}-linux-amd64 | |
| GOOS=darwin GOARCH=amd64 go build -o collect_data-latest-darwin-amd64 | |
| GOOS=darwin GOARCH=arm64 go build -o collect_data-latest-darwin-arm64 | |
| GOOS=linux GOARCH=amd64 go build -o collect_data-latest-linux-amd64 | |
| - name: Create Tag | |
| if: steps.check-tag-release.outputs.skip == 'false' | |
| id: tag_version | |
| uses: mathieudutour/github-tag-action@v6.2 | |
| with: | |
| github_token: ${{ secrets.ACCESS_TOKEN }} | |
| custom_tag: collect_data-v${{ steps.read_version.outputs.version }} | |
| tag_prefix: '' | |
| - name: Update -latest Tag | |
| if: steps.check-tag-release.outputs.skip == 'false' | |
| run: | | |
| set -e | |
| # Delete local and remote -latest tag if it exists | |
| git tag -d collect_data-latest 2>/dev/null || true | |
| git push origin :refs/tags/collect_data-latest 2>/dev/null || true | |
| # Create new -latest tag at current commit | |
| git tag collect_data-latest | |
| git push origin collect_data-latest --force | |
| - name: Create Version Release | |
| if: steps.check-tag-release.outputs.skip == 'false' | |
| id: create_version_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: Release collect_data v${{ steps.read_version.outputs.version }} | |
| tag: ${{ steps.tag_version.outputs.new_tag }} | |
| artifacts: action-plugins/collect_data/collect_data-v${{ steps.read_version.outputs.version }}-* | |
| skipIfReleaseExists: true | |
| generateReleaseNotes: true | |
| token: ${{ secrets.ACCESS_TOKEN }} | |
| - name: Create Latest Release | |
| if: steps.check-tag-release.outputs.skip == 'false' | |
| id: create_latest_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: Release collect_data latest | |
| tag: collect_data-latest | |
| artifacts: action-plugins/collect_data/collect_data-latest-* | |
| skipIfReleaseExists: false | |
| generateReleaseNotes: false | |
| token: ${{ secrets.ACCESS_TOKEN }} |