diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5da50a8..9263ab2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,66 +8,90 @@ permissions: contents: read jobs: - build: - name: Build - ${{ matrix.target }} - permissions: - contents: write # Only needed for release artifact uploads - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - strategy: - matrix: - include: - # Arm - - target: aarch64-unknown-linux-gnu - os: ubuntu-22.04 - - target: aarch64-unknown-linux-musl - os: ubuntu-22.04 - - target: aarch64-apple-darwin - os: macos-13 - - target: aarch64-pc-windows-msvc - os: windows-2022 - # x86 - - target: x86_64-unknown-linux-gnu - os: ubuntu-22.04 - - target: x86_64-unknown-linux-musl - os: ubuntu-22.04 - - target: x86_64-apple-darwin - os: macos-13 - - target: x86_64-pc-windows-msvc - os: windows-2022 - + goreleaser: + runs-on: ubuntu-latest steps: - - name: Checkout Git repo + - name: Checkout uses: actions/checkout@v4 with: - persist-credentials: false + fetch-depth: 0 - - name: Set Perl environment variables - if: runner.os == 'Windows' - run: | - echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 - echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install rust toolchain - if: ${{ !contains(matrix.target, 'apple') }} - uses: dtolnay/rust-toolchain@stable - - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - target: ${{ matrix.target }} - if: startsWith(matrix.os, 'ubuntu') && !contains(matrix.target, '-musl') - - uses: taiki-e/install-action@cross - if: contains(matrix.target, '-musl') + # build: + # name: Build - ${{ matrix.target }} + # permissions: + # contents: write # Only needed for release artifact uploads + # runs-on: ${{ matrix.os }} + # timeout-minutes: 60 + # strategy: + # matrix: + # include: + # # Arm + # - target: aarch64-unknown-linux-gnu + # os: ubuntu-22.04 + # - target: aarch64-unknown-linux-musl + # os: ubuntu-22.04 + # - target: aarch64-apple-darwin + # os: macos-13 + # - target: aarch64-pc-windows-msvc + # os: windows-2022 + # # x86 + # - target: x86_64-unknown-linux-gnu + # os: ubuntu-22.04 + # - target: x86_64-unknown-linux-musl + # os: ubuntu-22.04 + # - target: x86_64-apple-darwin + # os: macos-13 + # - target: x86_64-pc-windows-msvc + # os: windows-2022 - - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}" - if: endsWith(matrix.target, 'windows-msvc') + # steps: + # - name: Checkout Git repo + # uses: actions/checkout@v4 + # with: + # persist-credentials: false - - uses: taiki-e/upload-rust-binary-action@v1 - with: - bin: "uv-migrator" - target: ${{ matrix.target }} - tar: all - zip: windows - token: ${{ secrets.GITHUB_TOKEN }} - dry-run: false \ No newline at end of file + # - name: Set Perl environment variables + # if: runner.os == 'Windows' + # run: | + # echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + # echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + + # - name: Install rust toolchain + # if: ${{ !contains(matrix.target, 'apple') }} + # uses: dtolnay/rust-toolchain@stable + + # - uses: taiki-e/setup-cross-toolchain-action@v1 + # with: + # target: ${{ matrix.target }} + # if: startsWith(matrix.os, 'ubuntu') && !contains(matrix.target, '-musl') + + # - uses: taiki-e/install-action@cross + # if: contains(matrix.target, '-musl') + + # - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}" + # if: endsWith(matrix.target, 'windows-msvc') + + # - uses: taiki-e/upload-rust-binary-action@v1 + # with: + # bin: "uv-migrator" + # target: ${{ matrix.target }} + # tar: all + # zip: windows + # token: ${{ secrets.GITHUB_TOKEN }} + # dry-run: false \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..adcbc06 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,31 @@ +version: 2 + +before: + hooks: + - rustup default stable + - cargo install --locked cargo-zigbuild + - cargo fetch --locked + +builds: +- builder: rust + flags: + - --release + targets: + # linux + - x86_64-unknown-linux-gnu + - aarch64-unknown-linux-gnu + # macos + - x86_64-apple-darwin + - aarch64-apple-darwin + +archives: +- format: tar.gz + name_template: >- + {{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:"