|
| 1 | +name: Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - created |
| 7 | + |
| 8 | +jobs: |
| 9 | + macos: |
| 10 | + name: Upload macOS Catalina release binary |
| 11 | + runs-on: macos-10.15 |
| 12 | + |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + xcode: |
| 16 | + - "12" # Swift 5.3 |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + ref: ${{ github.event.release.tag_name }} |
| 23 | + - name: Build and Package |
| 24 | + run: | |
| 25 | + make swift-doc |
| 26 | + tar -cf swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar swift-doc |
| 27 | + gzip -f swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar |
| 28 | + env: |
| 29 | + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer |
| 30 | + - name: Upload |
| 31 | + |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + with: |
| 35 | + upload_url: ${{ github.event.release.upload_url }} |
| 36 | + asset_path: ./swift-doc |
| 37 | + asset_name: swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.tar.gz |
| 38 | + asset_content_type: application/gzip |
| 39 | + |
| 40 | + linux: |
| 41 | + name: Upload Linux release binary |
| 42 | + |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + swift: ["5.3"] |
| 48 | + |
| 49 | + container: |
| 50 | + image: swift:${{ matrix.swift }} |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v2 |
| 55 | + with: |
| 56 | + ref: ${{ github.event.release.tag_name }} |
| 57 | + - name: Install System Dependencies |
| 58 | + run: | |
| 59 | + apt-get update |
| 60 | + apt-get install -y libxml2-dev graphviz |
| 61 | + - name: Build and Package |
| 62 | + run: | |
| 63 | + make swift-doc |
| 64 | + tar -cf swift-doc-${{ github.event.release.tag_name }}.linux.bottle.tar.gz swift-doc |
| 65 | + gzip -f swift-doc-${{ github.event.release.tag_name }}.linux.bottle.tar.gz |
| 66 | + - name: Upload |
| 67 | + |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + with: |
| 71 | + upload_url: ${{ github.event.release.upload_url }} |
| 72 | + asset_path: ./swift-doc |
| 73 | + asset_name: swift-doc-${{ github.event.release.tag_name }}.linux.bottle.tar.gz |
| 74 | + asset_content_type: application/gzip |
| 75 | + |
| 76 | + homebrew: |
| 77 | + name: Update Homebrew formula |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: [macos, linux] |
| 80 | + steps: |
| 81 | + - uses: SwiftDocOrg/update-homebrew-formula-action@main |
| 82 | + with: |
| 83 | + repository: SwiftDocOrg/swift-doc |
| 84 | + tap: SwiftDocOrg/homebrew-formulae |
| 85 | + formula: Formula/swift-doc.rb |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + |
| 89 | + docker: |
| 90 | + name: Build and push Docker container |
| 91 | + |
| 92 | + runs-on: ubuntu-latest |
| 93 | + |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@v2 |
| 97 | + with: |
| 98 | + ref: ${{ github.event.release.tag_name }} |
| 99 | + - name: Set up QEMU |
| 100 | + uses: docker/setup-qemu-action@v1 |
| 101 | + - name: Set up Docker Buildx |
| 102 | + uses: docker/setup-buildx-action@v1 |
| 103 | + - name: Login to DockerHub |
| 104 | + uses: docker/login-action@v1 |
| 105 | + with: |
| 106 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 107 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 108 | + - name: Build and push |
| 109 | + uses: docker/build-push-action@v2 |
| 110 | + with: |
| 111 | + context: . |
| 112 | + file: ./Dockerfile |
| 113 | + platforms: linux/amd64 |
| 114 | + push: true |
| 115 | + tags: | |
| 116 | + swiftdoc/swift-doc:latest |
| 117 | + swiftdoc/swift-doc:${{ github.event.release.tag_name }} |
0 commit comments