v0.1.7 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2026 Raymond Auge <rayauge@doublebite.com> | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: CI/CD | |
| on: | |
| push: | |
| branches-ignore: | |
| - "dependabot/**" | |
| paths: | |
| - "**" | |
| - "!docs/**" | |
| tags: | |
| - "v*" | |
| pull_request: | |
| paths: | |
| - "**" | |
| - "!docs/**" | |
| env: | |
| LC_ALL: en_US.UTF-8 | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| release: | |
| name: Release | |
| if: (github.repository == 'rotty3000/durl') && startsWith(github.ref, 'refs/tags/') && (github.event_name != 'pull_request') | |
| needs: [lint, test] | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Install UPX | |
| run: sudo apt-get update && sudo apt-get install -y upx-ucl | |
| - name: Update Cargo.toml version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml | |
| - name: Build and Compress | |
| run: make compress | |
| - name: Prepare Release Assets | |
| run: | | |
| mkdir -p release-assets | |
| cp dist/x86_64-unknown-linux-musl/durl release-assets/durl-linux-amd64 | |
| cp dist/aarch64-unknown-linux-musl/durl release-assets/durl-linux-arm64 | |
| cp dist/x86_64-pc-windows-gnu/durl.exe release-assets/durl-windows-amd64.exe | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release-assets/* | |
| generate_release_notes: true | |
| - name: Update Homebrew Formula | |
| env: | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| # Source (macOS) | |
| SOURCE_URL="https://github.com/rotty3000/durl/archive/refs/tags/${TAG}.tar.gz" | |
| curl -L -o durl-source.tar.gz "$SOURCE_URL" | |
| SOURCE_SHA=$(sha256sum durl-source.tar.gz | awk '{print $1}') | |
| # Linux AMD64 | |
| AMD64_URL="https://github.com/rotty3000/durl/releases/download/${TAG}/durl-linux-amd64" | |
| AMD64_SHA=$(sha256sum dist/x86_64-unknown-linux-musl/durl | awk '{print $1}') | |
| # Linux ARM64 | |
| ARM64_URL="https://github.com/rotty3000/durl/releases/download/${TAG}/durl-linux-arm64" | |
| ARM64_SHA=$(sha256sum dist/aarch64-unknown-linux-musl/durl | awk '{print $1}') | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/rotty3000/homebrew-tap.git homebrew-tap | |
| cd homebrew-tap | |
| # Update Version | |
| sed -i "s|version \".*\"|version \"$VERSION\"|" Formula/durl.rb | |
| # Update Linux AMD64 (first occurrence of url/sha256 inside on_linux) | |
| # Using subtle perl-style matching to handle the separate blocks | |
| perl -i -0777 -pe "s|(if Hardware::CPU.intel\?.*?sha256 \").*?(\".*?url \").*?(\")|\${1}$AMD64_SHA\${2}$AMD64_URL\${3}|s" Formula/durl.rb | |
| # Update Linux ARM64 | |
| perl -i -0777 -pe "s|(elsif Hardware::CPU.arm\?.*?sha256 \").*?(\".*?url \").*?(\")|\${1}$ARM64_SHA\${2}$ARM64_URL\${3}|s" Formula/durl.rb | |
| # Update macOS/Source | |
| perl -i -0777 -pe "s|(on_macos.*?sha256 \").*?(\".*?url \").*?(\")|\${1}$SOURCE_SHA\${2}$SOURCE_URL\${3}|s" Formula/durl.rb | |
| git add Formula/durl.rb | |
| git commit -m "Update durl to $TAG" | |
| git push | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Run lint | |
| run: make lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run tests | |
| run: cargo test |