diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4d28199 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,124 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + build-linux-musl: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-unknown-linux-musl + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + use-cross: true + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: x86_64-unknown-linux-musl + path: ./target/release/clear-docker-images + + build-linux-gnu: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-unknown-linux-gnu + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + use-cross: true + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: x86_64-unknown-linux-gnu + path: ./target/release/clear-docker-images + + build-macos: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-apple-darwin + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + use-cross: true + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: x86_64-apple-darwin + path: ./target/release/clear-docker-images + + release: + runs-on: ubuntu-latest + needs: [build-macos, build-linux-gnu, build-linux-musl] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - run: mkdir -p binaries + + - name: download x86_64-apple-darwin + uses: actions/download-artifact@v3 + with: + name: x86_64-apple-darwin + - run: mv clear-docker-images binaries/x86_64-apple-darwin + + - name: download x86_64-unknown-linux-gnu + uses: actions/download-artifact@v3 + with: + name: x86_64-unknown-linux-gnu + - run: mv clear-docker-images binaries/x86_64-unknown-linux-gnu + + - name: download x86_64-unknown-linux-musl + uses: actions/download-artifact@v3 + with: + name: x86_64-unknown-linux-musl + - run: mv clear-docker-images binaries/x86_64-unknown-linux-musl + + - name: Get current and previous tags + run: | + echo ::set-output name=PREVIOUS_TAG::$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) + echo ::set-output name=CURRENT_TAG::${GITHUB_REF/refs\/tags\//} + id: tags + + - name: Release + uses: softprops/action-gh-release@v1 + with: + body: "**Full Changelog**: https://github.com/DataHearth/clear-docker-images/compare/${{ steps.tags.outputs.PREVIOUS_TAG }}...${{ steps.tags.outputs.CURRENT_TAG }}" + files: | + binaries/x86_64-unknown-linux-musl + binaries/x86_64-unknown-linux-gnu + binaries/x86_64-apple-darwin