diff --git a/.cargo/config.toml b/.cargo/config.toml index e2397a9..5d9e8ac 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,6 @@ +[registries.crates-io] +protocol = "sparse" + [profile.release] strip = true diff --git a/.github/workflows/release-rs.yml b/.github/workflows/release-rs.yml deleted file mode 100644 index f5851aa..0000000 --- a/.github/workflows/release-rs.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: "Release" - -on: - workflow_dispatch: - -jobs: - get-tag: - name: "Get Tag From Package Version" - runs-on: self-hosted - outputs: - crate-version: ${{ steps.crate-version.outputs.PKG_VERSION }} - steps: - - uses: actions/checkout@v3 - - name: "Get tag" - id: "crate-version" - shell: "bash" - run: | - echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT - - create-release: - name: "Create release" - needs: - - get-tag - runs-on: ubuntu-latest - steps: - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ needs.get-tag.outputs.crate-version}}" - prerelease: true - title: "Development Build" - files: | - LICENSE.txt - *.jar - upload-binaries: - - build: - name: "Build binaries and upload as artifacts" - needs: - - get-tag - strategy: - fail-fast: true - matrix: - include: - - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - - os: windows-latest - target: x86_64-pc-windows-gnu - - os: windows-latest - target: x86_64-pc-windows-msvc - - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - - uses: dtolnay/rust-toolchain@stable - with: - targets: "${{ matrix.target }}" - - - run: "cargo build --release --target ${{ matrix.target }}" - - - uses: actions/upload-artifact@v3 - with: - name: "jig-${{ matrix.target }}" - path: target/release/jig - - upload-binaries: - name: "Create release" - needs: - - get-tag - - build - runs-on: self-hosted - strategy: - fail-fast: true - matrix: - target: - - aarch64-unknown-linux-gnu - - arm-unknown-linux-gnueabi - - armv7-unknown-linux-gnueabihf - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - x86_64-pc-windows-gnu - steps: - - uses: actions/checkout@v3 - - - uses: actions/download-artifact@v3 - with: - name: "jig-${{ matrix.target }}" - -# upload assets to release here diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..11edb0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,96 @@ +name: "Create Release" + +on: + workflow_dispatch: + inputs: + draft: + required: false + default: true + description: Produce a draft release + type: boolean + +jobs: + get-tag: + name: "Get Tag From & Create release" + runs-on: self-hosted + outputs: + crate-version: ${{ steps.crate-version.outputs.CRATE_VERSION }} + steps: + - uses: actions/checkout@v3 + + - name: Get tag + id: "crate-version" + shell: "bash" + run: | + echo CRATE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' jig-cli/Cargo.toml) >> $GITHUB_OUTPUT + + - run: "echo '::notice:: Tag = v${{ steps.crate-version.outputs.CRATE_VERSION }}'" + + - name: Create draft release + if: ${{ github.event.inputs.draft }} + run: gh release create 'v${{ steps.crate-version.outputs.CRATE_VERSION }}' --title 'v${{ steps.crate-version.outputs.CRATE_VERSION }}' --draft + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Create release + if: ${{ !github.event.inputs.draft }} + run: gh release create 'v${{ steps.crate-version.outputs.CRATE_VERSION }}' + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + + build: + name: "Build and upload artifacts" + needs: + - get-tag + strategy: + fail-fast: false + matrix: + build: + - x86_64-linux + - x86_64-windows + feature: + - "" + - "cloud" + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + build: x86_64-linux + ext: "" + + - target: x86_64-pc-windows-msvc + os: windows-latest + build: x86_64-windows + ext: .exe + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: cargo-release-${{ matrix.build }}-${{ matrix.feature }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: cargo-release-${{ matrix.build }}-${{ matrix.feature }}- + + - uses: dtolnay/rust-toolchain@stable + with: + targets: "${{ matrix.target }}" + + - name: Build ${{ matrix.build }} default-features + if: ${{ matrix.feature == '' }} + run: cargo build --release --target ${{ matrix.target }} + - name: "Build ${{ matrix.build }} features: ${{ matrix.feature }}" + if: ${{ matrix.feature != '' }} + run: cargo build --release --features ${{ matrix.feature }} --target ${{ matrix.target }} + + - run: mkdir dist + - run: mv target/${{ matrix.target }}/release/jig${{ matrix.ext }} dist/jig-${{ matrix.feature }}${{ matrix.target }}${{ matrix.ext }} + - run: gh release upload 'v${{ needs.get-tag.outputs.crate-version }}' dist/jig-${{ matrix.feature }}${{ matrix.target }}${{ matrix.ext }} + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/test-rs.yml b/.github/workflows/test-rs.yml index 899cf0a..62bdf2f 100644 --- a/.github/workflows/test-rs.yml +++ b/.github/workflows/test-rs.yml @@ -5,7 +5,7 @@ on: paths: - src/** - .cargo/** - - .github/** + - .github/workflows/test-rs.yml pull_request: branches: [ "master" ] paths: