|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created, published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + formula: |
| 9 | + name: Update Homebrew formula |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Update the Homebrew formula with latest release |
| 13 | + uses: NSHipster/update-homebrew-formula-action@main |
| 14 | + with: |
| 15 | + repository: SwiftDocOrg/swift-doc |
| 16 | + tap: SwiftDocOrg/homebrew-formulae |
| 17 | + formula: Formula/swift-doc.rb |
| 18 | + env: |
| 19 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + |
| 21 | + bottle: |
| 22 | + name: Build and distribute Homebrew bottle for macOS Catalina |
| 23 | + runs-on: macos-10.15 |
| 24 | + needs: [formula] |
| 25 | + steps: |
| 26 | + - name: Build a bottle using Homebrew |
| 27 | + run: | |
| 28 | + brew tap swiftdocorg/formulae |
| 29 | + brew install --build-bottle --verbose swift-doc |
| 30 | + brew bottle swift-doc |
| 31 | + - name: Upload the bottle to the GitHub release |
| 32 | + uses: actions/upload-release-asset@v1.0.1 |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + with: |
| 36 | + upload_url: ${{ github.event.release.upload_url }} |
| 37 | + asset_path: ./swift-doc--${{ github.event.release.tag_name }}.catalina.bottle.tar.gz |
| 38 | + asset_name: swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar.gz |
| 39 | + asset_content_type: application/gzip |
| 40 | + - name: Update the Homebrew formula again with bottle |
| 41 | + uses: NSHipster/update-homebrew-formula-action@main |
| 42 | + with: |
| 43 | + repository: SwiftDocOrg/swift-doc |
| 44 | + tap: SwiftDocOrg/homebrew-formulae |
| 45 | + formula: Formula/swift-doc.rb |
| 46 | + message: | |
| 47 | + Add bottle for swift-doc ${{ github.event.release.tag_name }} |
| 48 | + on macOS Catalina |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + docker: |
| 53 | + name: Build and push Docker container |
| 54 | + |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v2 |
| 60 | + with: |
| 61 | + ref: ${{ github.event.release.tag_name }} |
| 62 | + - name: Set up QEMU |
| 63 | + uses: docker/setup-qemu-action@v1 |
| 64 | + - name: Set up Docker Buildx |
| 65 | + uses: docker/setup-buildx-action@v1 |
| 66 | + - name: Login to DockerHub |
| 67 | + uses: docker/login-action@v1 |
| 68 | + with: |
| 69 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 70 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 71 | + - name: Build and push |
| 72 | + uses: docker/build-push-action@v2 |
| 73 | + with: |
| 74 | + context: . |
| 75 | + file: ./Dockerfile |
| 76 | + platforms: linux/amd64 |
| 77 | + push: true |
| 78 | + tags: | |
| 79 | + swiftdoc/swift-doc:latest |
| 80 | + swiftdoc/swift-doc:${{ github.event.release.tag_name }} |
0 commit comments