fix: Correctly name artifact in build script #5
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: Create Unified Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate Release Notes | |
| id: release_notes | |
| run: | | |
| chmod +x ./scripts/generate_release_notes.sh | |
| NOTES=$(./scripts/generate_release_notes.sh) | |
| NOTES="${NOTES//'%'/'%25'}" | |
| NOTES="${NOTES//$'\n'/'%0A'}" | |
| NOTES="${NOTES//$'\r'/'%0D'}" | |
| echo "notes=$NOTES" >> $GITHUB_OUTPUT | |
| - name: Create Draft Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| body: ${{ steps.release_notes.outputs.notes }} | |
| name: Release ${{ github.ref_name }} | |
| draft: true | |
| prerelease: false | |
| build-and-upload: | |
| runs-on: ubuntu-latest | |
| needs: create-release | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - name: Build the Debian package | |
| run: | | |
| chmod +x ./scripts/build_packages.sh | |
| bash ./scripts/build_packages.sh ${{ github.ref_name }} | |
| - name: Upload Debian package to draft release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| asset_path: ./docker-ai_${{ github.ref_name }}_amd64.deb | |
| asset_name: docker-ai_${{ github.ref_name }}_amd64.deb | |
| asset_content_type: application/vnd.debian.binary-package | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| update-homebrew-tap: | |
| runs-on: ubuntu-latest | |
| needs: build-and-upload | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Homebrew tap repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Aj7Ay/homebrew-tap | |
| token: ${{ secrets.PAT_FOR_HOMEBREW_TAP }} | |
| path: homebrew-tap | |
| - name: Calculate SHA256 of the new release tarball | |
| id: shasum | |
| run: | | |
| RELEASE_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz" | |
| SHA256=$(curl -L $RELEASE_URL | shasum -a 256 | cut -d' ' -f1) | |
| echo "sha256=${SHA256}" >> $GITHUB_ENV | |
| - name: Update Homebrew formula | |
| run: | | |
| cd homebrew-tap | |
| sed -i "s|url \".*\"|url \"https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz\"|" docker-ai.rb | |
| sed -i "s/sha256 \".*\"/sha256 \"${{ env.sha256 }}\"/" docker-ai.rb | |
| - name: Commit and push changes | |
| run: | | |
| cd homebrew-tap | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add docker-ai.rb | |
| if git diff --staged --quiet; then | |
| echo "No changes to the formula to commit." | |
| else | |
| git commit -m "Update docker-ai to ${{ github.ref_name }}" | |
| git push | |
| fi | |
| publish-release: | |
| runs-on: ubuntu-latest | |
| needs: [create-release, update-homebrew-tap] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Publish the release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| id: ${{ needs.create-release.outputs.release_id }} | |
| draft: false |