|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - "v*.*.*" |
| 5 | + |
| 6 | +name: Build and Release |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-releases: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v2 |
| 15 | + |
| 16 | + - name: Cache build artifacts |
| 17 | + id: cache-cargo |
| 18 | + uses: actions/cache@v2 |
| 19 | + with: |
| 20 | + path: | |
| 21 | + ~/.cargo/bin |
| 22 | + ~/.cargo/registry |
| 23 | + ~/.cargo/git |
| 24 | + target |
| 25 | + key: build-${{ runner.os }}-cargo-any |
| 26 | + |
| 27 | + - name: Install Rust toolchain |
| 28 | + uses: actions-rs/toolchain@v1 |
| 29 | + with: |
| 30 | + toolchain: stable |
| 31 | + components: rustfmt |
| 32 | + override: true |
| 33 | + |
| 34 | + - name: Install cross-compilation tools (if needed) |
| 35 | + run: which cross >/dev/null || cargo install cross |
| 36 | + |
| 37 | + - name: Verify versions |
| 38 | + run: rustc --version && rustup --version && cargo --version && cross --version |
| 39 | + |
| 40 | + - name: Get current tag |
| 41 | + id: current_tag |
| 42 | + uses: WyriHaximus/github-action-get-previous-tag@v1 |
| 43 | + |
| 44 | + - name: Release binaries |
| 45 | + run: ./scripts/release_binaries.sh --version=${{ steps.current_tag.outputs.tag }} |
| 46 | + |
| 47 | + - name: Release new version |
| 48 | + uses: softprops/action-gh-release@v1 |
| 49 | + with: |
| 50 | + tag_name: ${{ steps.current_tag.outputs.tag }} |
| 51 | + name: Vigil ${{ steps.current_tag.outputs.tag }} |
| 52 | + body: "⚠️ Changelog not yet provided." |
| 53 | + files: ./${{ steps.current_tag.outputs.tag }}-*.tar.gz |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + build-docker: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout code |
| 62 | + uses: actions/checkout@v2 |
| 63 | + |
| 64 | + - name: Acquire Docker image metadata |
| 65 | + id: metadata |
| 66 | + uses: docker/metadata-action@v4 |
| 67 | + with: |
| 68 | + images: valeriansaliou/vigil |
| 69 | + |
| 70 | + - name: Login to Docker Hub |
| 71 | + uses: docker/login-action@v2 |
| 72 | + with: |
| 73 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 74 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 75 | + |
| 76 | + - name: Build and push Docker image |
| 77 | + uses: docker/build-push-action@v3 |
| 78 | + with: |
| 79 | + context: . |
| 80 | + tags: ${{ steps.metadata.outputs.tags }} |
| 81 | + labels: ${{ steps.metadata.outputs.labels }} |
| 82 | + push: true |
0 commit comments