diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc40506..73d2d0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,6 @@ on: push: branches: - 'main' - tags: - - "v[0-9]+.[0-9]+.[0-9]+**" env: RUSTFLAGS: -D warnings @@ -46,7 +44,6 @@ jobs: run: cargo check --all-targets --all-features - name: "`cargo test`" run: cargo test --no-fail-fast --verbose --locked - clippy: name: Clippy runs-on: ubuntu-latest @@ -58,102 +55,3 @@ jobs: - name: "`cargo clippy`" run: cargo clippy --all-targets --all-features - release: - if: startsWith(github.ref, 'refs/tags/v') - strategy: - matrix: - include: - - target: x86_64-pc-windows-msvc - os: windows-latest - - target: x86_64-apple-darwin - os: macos-latest - - target: aarch64-apple-darwin - os: macos-latest - - target: x86_64-unknown-linux-gnu - os: ubuntu-20.04 - - target: x86_64-unknown-linux-musl - os: ubuntu-20.04 - c: true - - target: aarch64-unknown-linux-gnu - os: ubuntu-20.04 - c: true - - target: aarch64-unknown-linux-musl - os: ubuntu-20.04 - c: true - name: GitHub Release (${{ matrix.target }}) - runs-on: ${{ matrix.os }} - needs: [check, clippy] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: rust-toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - targets: ${{ matrix.target }} - - name: "`cargo build --release`" - if: "!matrix.c" - run: cargo build --release --target ${{ matrix.target }} - - name: '`cargo zigbuild --release`' - if: "matrix.c" - run: | - pip3 install cargo-zigbuild - cargo zigbuild --release --target ${{ matrix.target }} - - name: Create an asset - id: asset - run: | - if ${{ contains(matrix.target, 'pc-windows') }}; then - EXE=.exe - fi - EXECUTABLE="./target/${{ matrix.target }}/release/${GITHUB_REPOSITORY#*/}$EXE" - ASSET_STEM="${GITHUB_REPOSITORY#*/}-${GITHUB_REF#refs/tags/}-${{ matrix.target }}" - git archive -o "./$ASSET_STEM.tar" --prefix "$ASSET_STEM/" HEAD - tar -xf "./$ASSET_STEM.tar" - mv "$EXECUTABLE" "./$ASSET_STEM/" - if ${{ contains(matrix.target, 'pc-windows') }}; then - ASSET="./$ASSET_STEM.zip" - 7z a "$ASSET" "./$ASSET_STEM" - zipinfo "$ASSET" - else - ASSET="./$ASSET_STEM.tar.gz" - tar -czvf "$ASSET" "./$ASSET_STEM" - fi - echo "asset=$ASSET" >> $GITHUB_OUTPUT - shell: bash - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - configurationJson: | - { - "tag_resolver": { - "pattern": "v(.+)" - } - } - - name: GH Release - uses: softprops/action-gh-release@v1 - with: - files: ${{ steps.asset.outputs.asset }} - body: ${{steps.github_release.outputs.changelog}} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - publish: - if: startsWith(github.ref, 'refs/tags/v') - name: Publish to crates.io - runs-on: ubuntu-latest - needs: [check, clippy] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: rust-toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - - name: publish - run: cargo publish --token ${CRATES_TOKEN} - env: - CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..f1673bd --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,91 @@ +name: CI + +on: + release: + types: [published] + +env: + RUSTFLAGS: -D warnings + +jobs: + release: + if: github.repository_owner == 'vita-rust' + strategy: + matrix: + include: + - target: x86_64-pc-windows-msvc + os: windows-latest + - target: x86_64-apple-darwin + os: macos-latest + - target: aarch64-apple-darwin + os: macos-latest + - target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + - target: x86_64-unknown-linux-musl + os: ubuntu-20.04 + c: true + - target: aarch64-unknown-linux-gnu + os: ubuntu-20.04 + c: true + - target: aarch64-unknown-linux-musl + os: ubuntu-20.04 + c: true + name: GitHub Release (${{ matrix.target }}) + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: rust-toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: ${{ matrix.target }} + - name: "`cargo build --release`" + if: "!matrix.c" + run: cargo build --release --target ${{ matrix.target }} + - name: '`cargo zigbuild --release`' + if: "matrix.c" + run: | + pip3 install cargo-zigbuild + cargo zigbuild --release --target ${{ matrix.target }} + - name: Create an asset + id: asset + run: | + if ${{ contains(matrix.target, 'pc-windows') }}; then + EXE=.exe + fi + EXECUTABLE="./target/${{ matrix.target }}/release/${GITHUB_REPOSITORY#*/}$EXE" + ASSET_STEM="${GITHUB_REPOSITORY#*/}-${GITHUB_REF#refs/tags/}-${{ matrix.target }}" + git archive -o "./$ASSET_STEM.tar" --prefix "$ASSET_STEM/" HEAD + tar -xf "./$ASSET_STEM.tar" + mv "$EXECUTABLE" "./$ASSET_STEM/" + if ${{ contains(matrix.target, 'pc-windows') }}; then + ASSET="./$ASSET_STEM.zip" + 7z a "$ASSET" "./$ASSET_STEM" + zipinfo "$ASSET" + else + ASSET="./$ASSET_STEM.tar.gz" + tar -czvf "$ASSET" "./$ASSET_STEM" + fi + echo "asset=$ASSET" >> $GITHUB_OUTPUT + shell: bash + - name: GH Release + uses: softprops/action-gh-release@v1 + with: + files: ${{ steps.asset.outputs.asset }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish: + name: Publish to crates.io + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: rust-toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + - name: publish + run: cargo publish --token ${CRATES_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} diff --git a/.github/workflows/release-pr.yaml b/.github/workflows/release-pr.yaml new file mode 100644 index 0000000..1b0a7e0 --- /dev/null +++ b/.github/workflows/release-pr.yaml @@ -0,0 +1,58 @@ +name: Create a release PR + +permissions: + pull-requests: write + contents: write + +on: + workflow_dispatch: + inputs: + version: + type: choice + description: Version update + options: + - patch + - minor + - major + +jobs: + release-pr: + runs-on: ubuntu-latest + steps: + - name: Generate GitHub token + uses: actions/create-github-app-token@v1 + id: generate-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + - name: Install cargo-edit + uses: taiki-e/install-action@v2 + with: + tool: cargo-workspaces,git-cliff + - id: bump + name: Update version + run: | + cargo workspaces version --force cargo-vita ${{ inputs.version }} -ay --no-git-commit; + cat Cargo.toml | grep ^version\ = | sed 's/[" ]//g' >> "$GITHUB_OUTPUT" + - name: Update changelog + run: git cliff -t v${{ steps.bump.outputs.version }} -u --prepend CHANGELOG.md + - id: changelog + name: Generate a changelog for PR body + run: git cliff -t v${{ steps.bump.outputs.version }} -u -o .CHANGELOG.md --strip footer + env: + GIT_CLIFF__CHANGELOG__HEADER: "# Changelog\n\n" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ steps.generate-token.outputs.token }} + title: Release v${{ steps.bump.outputs.version }} + commit-message: Release v${{ steps.bump.outputs.version }} + body-path: .CHANGELOG.md + branch: release + labels: release + delete-branch: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..344de83 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +name: Release + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + create-release: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'release') + steps: + - name: Generate GitHub token + uses: actions/create-github-app-token@v1 + id: generate-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout Code + uses: actions/checkout@v4 + - name: Extract version from PR title + id: tag + run: echo "${{ github.event.pull_request.title }}" | awk '{print "name=" $2}' >> "$GITHUB_OUTPUT" + - name: Push a new tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ steps.generate-token.outputs.token }} + custom_tag: ${{ steps.tag.outputs.name }} + tag_prefix: "" + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag.outputs.name }} + name: ${{ github.event.pull_request.title }} + body: ${{ github.event.pull_request.body }} + token: ${{ steps.generate-token.outputs.token }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9113b4f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,112 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.11] - 2024-01-12 +### Details +#### Changed +- Replaced unmaintained ftp crate with its fork suppaftp (#8) +- Use log crate for cargo-vita output (#7) +- Disabled no-log feature of suppaftp +- Added logs subcommand to edit PrincessLog config remotely (#10) +- Add rust-src component to recommended rust-toolchain.toml (#11) + + +## [0.1.11] - 2024-01-12 +### Details +#### Changed +- Replace vita-rust wiki link with book link (#5) +- Reverted set_cargo_config_env (#6) + + +## [0.1.10] - 2023-10-14 +### Details +#### Changed +- Fixed release changelog generation +- Passing env variables for pkgconfig during cargo build (#3) + + +## [0.1.9] - 2023-10-08 +### Details +#### Changed +- Return exit code 1 on failure + + +## [0.1.8] - 2023-10-08 +### Details +#### Changed +- Update README.md +- Fail build if cargo build does not succeed + + +## [0.1.7] - 2023-09-26 +### Details +#### Changed +- Auto set OPENSSL_LIB_DIR and OPENSSL_INCLUDE_DIR env vars + + +## [0.1.6] - 2023-09-13 +### Details +#### Changed +- Fixed target path for coredumps + + +## [0.1.5] - 2023-09-13 +### Details +#### Changed +- More build targets +- Fixed coredump parse + + +## [0.1.4] - 2023-09-13 +### Details +#### Changed +- Add cargo env variables (#1) +- Fixed CI pipeline and updated README +- Release v0.1.4 + + +## [0.1.3] - 2023-09-12 +### Details +#### Changed +- Added quiet flag as opposed to always having to set -v flag +- Fixed README + + +## [0.1.2] - 2023-09-12 +### Details +#### Changed +- Updated to latest cargo_metadata +- An env fallback for default_title_id +- Update README.md +- Fix static file paths + + +## [0.1.1] - 2023-09-11 +### Details +#### Changed +- VITA_IP is not required for build anymore + + +## [0.1.0] - 2023-09-11 +### Details +#### Changed +- Initial commit +- Initial build implementation +- Build command +- Update and run eboot +- Update and upload flags for vpk +- Readme +- Coredump +- Updated Readme.md +- Release ci job +- Workspace_default_packages hack until cargo_metadata is released +- Updated README.md +- Fixed CI +- Another attempt to fix CI +- Disabled cross-compilation +- Less targets + + diff --git a/Cargo.toml b/Cargo.toml index a02fa6f..b2c3fef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" authors = ["vita-sdk", "Nikolay Arhipov "] keywords = ["vita", "homebrew"] categories = ["command-line-utilities", "development-tools::cargo-plugins"] -exclude = [".github", ".vscode", "target"] +exclude = [".github", ".vscode", "target", "cliff.toml"] [dependencies] anyhow = { version = "1.0.75", features = ["backtrace"] } diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..b29bf11 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,76 @@ +# git-cliff ~ default configuration file +# https://git-cliff.org/docs/configuration +# +# Lines starting with "#" are comments. +# Configuration options are organized into tables and keys. +# See documentation for more information on available options. + +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n +""" +# template for the changelog body +# https://keats.github.io/tera/docs/#introduction +body = """ +{% if version -%} + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else -%} + ## [Unreleased] +{% endif -%} + +### Details\ + +{% for group, commits in commits | group_by(attribute="group") %} + #### {{ group | upper_first }} + {%- for commit in commits %} + - {{ commit.message | upper_first | trim }}\ + {% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%} + {% if commit.github.pr_number %} in #{{ commit.github.pr_number }}{%- endif -%} + {% endfor %} +{% endfor %} + + +""" +# remove the leading and trailing whitespace from the template +trim = true + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = false +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + { pattern = "\n.*", replace = ""} +] + +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^.*: add", group = "Added" }, + { message = "^.*: support", group = "Added" }, + { message = "^.*: remove", group = "Removed" }, + { message = "^.*: delete", group = "Removed" }, + { message = "^test", group = "Fixed" }, + { message = "^fix", group = "Fixed" }, + { message = "^.*: fix", group = "Fixed" }, + { message = "^.*", group = "Changed" }, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = false +# regex for matching git tags +tag_pattern = "v[0-9].*" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" +# limit the number of commits included in the changelog. +# limit_commits = 42