chore: find root cause 1 #5
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 Finch Daemon | |
| on: | |
| workflow_dispatch: | |
| workflow_call: | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| env: | |
| GO_VERSION: '1.22.7' | |
| permissions: | |
| contents: write | |
| deployments: write | |
| jobs: | |
| get-latest-tag: | |
| name: Get the latest release tag | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.latest-tag.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| fetch-depth: 0 | |
| - name: 'Get the latest tag' | |
| id: latest-tag | |
| uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0 | |
| generate-artifacts: | |
| needs: get-latest-tag | |
| runs-on: ubuntu-20.04 | |
| env: | |
| # Set during setup. | |
| RELEASE_TAG: ${{ needs.get-latest-tag.outputs.tag }} | |
| DYNAMIC_BINARY_NAME: '' | |
| STATIC_BINARY_NAME: '' | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| fetch-tags: true | |
| - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: false | |
| - name: 'Echo RELEASE_TAG ENV' | |
| run: echo ${{ env.RELEASE_TAG }} | |
| - name: What Happens in git describe | |
| run: | | |
| echo "Git describe output:" | |
| git describe --match 'v[0-9]*' --dirty='.modified' --always --tags | |
| - name: Inspect Git state | |
| run: | | |
| echo "git describe all" | |
| git describe --all | |
| echo "Git describe output:" | |
| git describe --tags | |
| echo "Current branch:" | |
| git branch --show-current | |
| echo "Latest tag:" | |
| git describe --tags --abbrev=0 | |
| echo "Commit hash:" | |
| git rev-parse HEAD | |
| echo "All tags:" | |
| git tag -l | |
| - name: Setup variables and release directories | |
| run: | | |
| export release_tag=${{ env.RELEASE_TAG }} | |
| export release_version=${release_tag/v/} # Remove v from tag name | |
| echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV | |
| echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV | |
| mkdir release | |
| - name: Install Go licenses | |
| run: go install github.com/google/go-licenses@latest | |
| - name: Create Third Party Licences File | |
| run: make licenses | |
| - name: setup static dependecies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libc6-dev -f | |
| - name: Create release binaries | |
| run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release | |
| - name: Verify Release version | |
| run: | | |
| mkdir -p output/static output/dynamic | |
| tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic | |
| tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static | |
| if [ -f "./output/dynamic/finch-daemon" ]; then | |
| echo "finch-daemon exists in output/dynamic" | |
| ls -l ./output/dynamic/finch-daemon | |
| else | |
| echo "finch-daemon does not exist in output/dynamic" | |
| ls -l ./output/dynamic | |
| fi | |
| echo "Output of finch-daemon --version:" | |
| ./output/dynamic/finch-daemon --version | |
| if command -v grep &> /dev/null; then | |
| echo "grep is available" | |
| VERSION_OUTPUT=$(./output/dynamic/finch-daemon --version) | |
| echo "grep output:" | |
| echo "$VERSION_OUTPUT" | grep -oP '\d+\.\d+\.\d+' | |
| else | |
| echo "grep is not available" | |
| fi | |
| DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') | |
| STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') | |
| export release_tag=${{ env.RELEASE_TAG }} | |
| export release_version=${release_tag/v/} | |
| if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then | |
| echo "Version mismatch" | |
| exit 1 | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts | |
| path: release/ | |
| if-no-files-found: error | |
| outputs: | |
| release_tag: ${{ env.RELEASE_TAG }} | |
| dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }} | |
| static_binary_name: ${{ env.STATIC_BINARY_NAME }} | |
| # validate-artifacts: | |
| # needs: generate-artifacts | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/download-artifact@v4 | |
| # with: | |
| # name: artifacts | |
| # path: release/ | |
| # - run: bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }} | |
| # create-release: | |
| # needs: [generate-artifacts, validate-artifacts] | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/download-artifact@v4 | |
| # with: | |
| # name: artifacts | |
| # - uses: softprops/action-gh-release@v2 | |
| # with: | |
| # tag_name: ${{ needs.generate-artifacts.outputs.release_tag }} | |
| # prerelease: false | |
| # generate_release_notes: false | |
| # files: | | |
| # ${{ needs.generate-artifacts.outputs.dynamic_binary_name }} | |
| # ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum | |
| # ${{ needs.generate-artifacts.outputs.static_binary_name }} | |
| # ${{ needs.generate-artifacts.outputs.static_binary_name }}.sha256sum |