Merge pull request #12 from restaumatic/add-builds-arm64 #29
Workflow file for this run
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: Publish | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-latest | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: start service container | |
| run: | | |
| docker run --rm -d --name minio -p 9000:9000 \ | |
| -e MINIO_ROOT_USER=minioadmin \ | |
| -e MINIO_ROOT_PASSWORD=minioadmin \ | |
| quay.io/minio/minio server /data | |
| sleep 3 | |
| curl -s -D- http://localhost:9000 | |
| - uses: actions/checkout@v2 | |
| - uses: haskell-actions/setup@v2 | |
| with: | |
| enable-stack: true | |
| stack-version: 'latest' | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-stack | |
| with: | |
| path: ~/.stack | |
| key: ${{ runner.os }}-${{ matrix.arch }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.arch }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-${{ matrix.arch }}-build- | |
| ${{ runner.os }}-${{ matrix.arch }}- | |
| - name: Build dependencies | |
| run: | | |
| stack --no-terminal build --test --only-dependencies | |
| - name: Build | |
| run: | | |
| mkdir dist | |
| stack --no-terminal build --test --no-run-tests --copy-bins --local-bin-path dist | |
| - name: Test | |
| run: | | |
| export TASKRUNNER_TEST_S3_ENDPOINT=http://localhost:9000 | |
| export TASKRUNNER_TEST_S3_ACCESS_KEY=minioadmin | |
| export TASKRUNNER_TEST_S3_SECRET_KEY=minioadmin | |
| stack --no-terminal build --test | |
| - name: Package | |
| run: | | |
| cd dist | |
| # Create architecture-specific archive | |
| tar czvf taskrunner-linux-${{ matrix.arch }}.tar.gz taskrunner | |
| # For x86_64, also create legacy name for backward compatibility | |
| if [ "${{ matrix.arch }}" == "x86_64" ]; then | |
| cp taskrunner-linux-${{ matrix.arch }}.tar.gz taskrunner-linux.tar.gz | |
| fi | |
| # Upload artifacts from both architecture builds | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: taskrunner-linux-${{ matrix.arch }} | |
| path: | | |
| dist/*.tar.gz | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List artifacts | |
| run: ls -laR artifacts/ | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| release_name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| # Upload x86_64 with legacy name (backward compatibility) | |
| - name: Upload Release Asset (Linux - Legacy) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./artifacts/taskrunner-linux-x86_64/dist/taskrunner-linux.tar.gz | |
| asset_name: taskrunner-linux.tar.gz | |
| asset_content_type: application/x-tar | |
| # Upload x86_64 with explicit architecture | |
| - name: Upload Release Asset (Linux x86_64) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./artifacts/taskrunner-linux-x86_64/dist/taskrunner-linux-x86_64.tar.gz | |
| asset_name: taskrunner-linux-x86_64.tar.gz | |
| asset_content_type: application/x-tar | |
| # Upload ARM64 | |
| - name: Upload Release Asset (Linux ARM64) | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./artifacts/taskrunner-linux-arm64/dist/taskrunner-linux-arm64.tar.gz | |
| asset_name: taskrunner-linux-arm64.tar.gz | |
| asset_content_type: application/x-tar |