|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - "v*" |
| 6 | + |
| 7 | +jobs: |
| 8 | + release-amd64: |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Extract version from tag |
| 20 | + id: version |
| 21 | + uses: damienaicheh/extract-version-from-tag-action@v1.0.0 |
| 22 | + |
| 23 | + - name: Build |
| 24 | + run: cargo build --release --verbose |
| 25 | + |
| 26 | + - name: Archive executable (linux) |
| 27 | + if: matrix.os == 'ubuntu-latest' |
| 28 | + working-directory: ./target/release |
| 29 | + run: tar czvf ../../highlights-linux-amd64.tar.gz highlights |
| 30 | + |
| 31 | + - name: Archive executable (mac) |
| 32 | + if: matrix.os == 'macos-latest' |
| 33 | + working-directory: ./target/release |
| 34 | + run: tar czvf ../../highlights-macos-amd64.tar.gz highlights |
| 35 | + |
| 36 | + - name: Archive executable (windows) |
| 37 | + if: matrix.os == 'windows-latest' |
| 38 | + working-directory: ./target/release |
| 39 | + run: Compress-Archive -LiteralPath highlights.exe -DestinationPath ../../highlights-windows-amd64.zip |
| 40 | + |
| 41 | + - name: Create release |
| 42 | + uses: softprops/action-gh-release@v1 |
| 43 | + with: |
| 44 | + files: highlights-* |
| 45 | + draft: true |
| 46 | + prerelease: ${{ steps.version.outputs.PRE_RELEASE != ''}} |
| 47 | + |
| 48 | + release-macos-aarch64: |
| 49 | + runs-on: macos-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v2 |
| 54 | + |
| 55 | + - name: Extract version from tag |
| 56 | + id: version |
| 57 | + uses: damienaicheh/extract-version-from-tag-action@v1.0.0 |
| 58 | + |
| 59 | + - name: Install latest stable rust toolchain |
| 60 | + uses: actions-rs/toolchain@v1 |
| 61 | + with: |
| 62 | + toolchain: stable |
| 63 | + target: aarch64-apple-darwin |
| 64 | + default: true |
| 65 | + override: true |
| 66 | + |
| 67 | + - name: Build |
| 68 | + run: cargo build --release --target aarch64-apple-darwin --verbose |
| 69 | + |
| 70 | + - name: Archive executable |
| 71 | + working-directory: ./target/release |
| 72 | + run: tar czvf ../../highlights-macos-aarch64.tar.gz highlights |
| 73 | + |
| 74 | + - name: Create release |
| 75 | + uses: softprops/action-gh-release@v1 |
| 76 | + with: |
| 77 | + files: highlights-* |
| 78 | + draft: true |
| 79 | + prerelease: ${{ steps.version.outputs.PRE_RELEASE != ''}} |
| 80 | + |
| 81 | + release-linux-aarch64: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@v2 |
| 87 | + |
| 88 | + - name: Extract version from tag |
| 89 | + id: version |
| 90 | + uses: damienaicheh/extract-version-from-tag-action@v1.0.0 |
| 91 | + |
| 92 | + - name: Install latest stable rust toolchain |
| 93 | + uses: actions-rs/toolchain@v1 |
| 94 | + with: |
| 95 | + toolchain: stable |
| 96 | + target: aarch64-linux-gnu |
| 97 | + default: true |
| 98 | + override: true |
| 99 | + |
| 100 | + - name: Build |
| 101 | + run: cargo build --release --target aarch64-linux-gnu --verbose |
| 102 | + |
| 103 | + - name: Archive executable |
| 104 | + working-directory: ./target/release |
| 105 | + run: tar czvf ../../highlights-linux-aarch64.tar.gz highlights |
| 106 | + |
| 107 | + - name: Create release |
| 108 | + uses: softprops/action-gh-release@v1 |
| 109 | + with: |
| 110 | + files: highlights-* |
| 111 | + draft: true |
| 112 | + prerelease: ${{ steps.version.outputs.PRE_RELEASE != ''}} |
| 113 | + |
| 114 | + release-docker: |
| 115 | + runs-on: ubuntu-latest |
| 116 | + |
| 117 | + steps: |
| 118 | + - name: Checkout |
| 119 | + uses: actions/checkout@v2 |
| 120 | + |
| 121 | + - name: Extract version from tag |
| 122 | + id: version |
| 123 | + uses: damienaicheh/extract-version-from-tag-action@v1.0.0 |
| 124 | + |
| 125 | + - name: Login |
| 126 | + uses: docker/login-action@v1 |
| 127 | + with: |
| 128 | + username: thatsnomoon |
| 129 | + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
| 130 | + |
| 131 | + - name: Set up Buildx |
| 132 | + uses: docker/setup-buildx-action@v2 |
| 133 | + |
| 134 | + - name: Build and push amd64 |
| 135 | + uses: docker/build-push-action@v2 |
| 136 | + with: |
| 137 | + context: ./ |
| 138 | + file: ./Dockerfile |
| 139 | + platforms: linux/amd64 |
| 140 | + push: true |
| 141 | + tags: | |
| 142 | + thatsnomoon/highlights:latest |
| 143 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }}.${{ steps.version.outputs.PATCH }} |
| 144 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }} |
| 145 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }} |
| 146 | + cache-from: type=registry,ref=thatsnomoon/highlights:buildcache |
| 147 | + cache-to: type=registry,ref=thatsnomoon/highlights:buildcache,mode=max |
| 148 | + |
| 149 | + - name: Build and push arm64 |
| 150 | + uses: docker/build-push-action@v2 |
| 151 | + with: |
| 152 | + context: ./ |
| 153 | + file: ./Dockerfile |
| 154 | + platforms: linux/arm64 |
| 155 | + build-args: | |
| 156 | + RUSTTARGET=aarch64-unknown-linux-musl |
| 157 | + MUSLHOST=x86_64-linux-musl |
| 158 | + MUSLTARGET=aarch64-linux-musl |
| 159 | + push: true |
| 160 | + tags: | |
| 161 | + thatsnomoon/highlights:latest |
| 162 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }}.${{ steps.version.outputs.PATCH }} |
| 163 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }} |
| 164 | + thatsnomoon/highlights:${{ steps.version.outputs.MAJOR }} |
| 165 | + cache-from: type=registry,ref=thatsnomoon/highlights:buildcache |
| 166 | + cache-to: type=registry,ref=thatsnomoon/highlights:buildcache,mode=max |
0 commit comments