Skip to content

fix(install): remove passed through flags from packages #197

fix(install): remove passed through flags from packages

fix(install): remove passed through flags from packages #197

Workflow file for this run

name: Test and publish Supreme
on:
push:
branches: [main]
# Cancel previously running workflows
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Rust (nightly)
uses: dtolnay/rust-toolchain@nightly
id: rust-toolchain
with:
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --locked
- name: Run linting
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
# Analyze commits and determine if a new release should be published
# If a new release should be published, the next version is outputted
next-version:
name: Get next version
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install semantic-release-cargo
uses: taiki-e/install-action@v2
with:
tool: semantic-release-cargo@2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
dry_run: true
semantic_version: 17.1.1
extra_plugins: |
@semantic-release/changelog@5.0.1
@semantic-release/exec@5.0
@semantic-release/git@9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: New release should be published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
build:
name: Build
needs: [test, next-version]
if: needs.next-version.outputs.new_release_published == 'true'
runs-on: ${{ matrix.build.os }}
env:
NAME: supreme-${{ matrix.build.target }}
CARGO: cargo
strategy:
matrix:
build:
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
- os: ubuntu-latest
target: i686-unknown-linux-gnu
cross: true
- os: ubuntu-latest
target: i686-unknown-linux-musl
cross: true
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: false
- os: macOS-latest
target: x86_64-apple-darwin
cross: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Rust (nightly)
uses: dtolnay/rust-toolchain@nightly
id: rust-toolchain
with:
target: ${{ matrix.build.target }}
- name: Cache cargo
uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install semantic-release-cargo
uses: taiki-e/install-action@v2
with:
tool: semantic-release-cargo@2
- name: Prepare semantic-release for Rust
run: semantic-release-cargo prepare ${{ needs.next-version.outputs.new_release_version }}
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Configure cross
if: matrix.build.cross
run: echo "CARGO=cross" >> "$GITHUB_ENV"
- name: Compile release binary
run: ${{ env.CARGO }} build --bin supreme --release --target ${{ matrix.build.target }}
- name: Create release archive
id: release
run: |
mkdir "$NAME"
cp target/${{ matrix.build.target }}/release/supreme "$NAME/"
cp README.md "$NAME/"
tar -czvf "$NAME.tar.gz" "$NAME"
SHA=$(shasum -a 256 "$NAME.tar.gz" | cut -d " " -f 1)
echo "SHA=$SHA" >> $GITHUB_OUTPUT
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build.target }}
path: ${{ env.NAME }}.tar.gz
if-no-files-found: error
retention-days: 1
build-macos:
name: Build (Apple Silicon)
needs: [test, next-version]
if: needs.next-version.outputs.new_release_published == 'true'
runs-on: macOS-latest
outputs:
sha: ${{ steps.release.outputs.SHA }}
env:
NAME: supreme-aarch64-apple-darwin
TARGET: aarch64-apple-darwin
CARGO: cargo
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Rust (nightly)
uses: dtolnay/rust-toolchain@nightly
id: rust-toolchain
with:
target: ${{ env.TARGET }}
- name: Cache cargo
uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install semantic-release-cargo
uses: taiki-e/install-action@v2
with:
tool: semantic-release-cargo@2
- name: Prepare semantic-release for Rust
run: semantic-release-cargo prepare ${{ needs.next-version.outputs.new_release_version }}
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Configure cross
run: echo "CARGO=cross" >> "$GITHUB_ENV"
- name: Compile release binary
run: ${{ env.CARGO }} build --bin supreme --release --target ${{ env.TARGET }}
- name: Create release archive
id: release
run: |
mkdir "$NAME"
cp target/${{ env.TARGET }}/release/supreme "$NAME/"
cp README.md "$NAME/"
tar -czvf "$NAME.tar.gz" "$NAME"
SHA=$(shasum -a 256 "$NAME.tar.gz" | cut -d " " -f 1)
echo "SHA=$SHA" >> $GITHUB_OUTPUT
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.TARGET }}
path: ${{ env.NAME }}.tar.gz
if-no-files-found: error
retention-days: 1
release:
name: Create release
needs: [build-macos, build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download release artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: ls artifacts
run: ls -R ./artifacts
- name: Install semantic-release-cargo
uses: taiki-e/install-action@v2
with:
tool: semantic-release-cargo@2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
semantic_version: 17.1.1
extra_plugins: |
@semantic-release/changelog@5.0.1
@semantic-release/exec@5.0
@semantic-release/git@9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
homebrew:
name: Publish on Homebrew
runs-on: ubuntu-latest
if: needs.next-version.outputs.new_release_published == 'true'
needs: [next-version, build-macos, release]
env:
SHA: ${{ needs.build-macos.outputs.sha }}
VERSION: ${{ needs.next-version.outputs.new_release_version }}
steps:
- name: Checkout Homebrew formula
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
repository: opendevtools/homebrew-supreme
path: homebrew-supreme
- name: Create template file
uses: "finnp/create-file-action@master"
env:
FILE_NAME: "homebrew-supreme/template.rb"
FILE_BASE64: "Y2xhc3MgU3VwcmVtZSA8IEZvcm11bGEKICB2ZXJzaW9uICJ7e3ZlcnNpb259fSIKICBkZXNjICJBIENMSSB0b29sIHRoYXQgaGVscHMgeW91IGdldCB1cCBhbiBydW5uaW5nIGZhc3QiCiAgaG9tZXBhZ2UgImh0dHBzOi8vZ2l0aHViLmNvbS9vcGVuZGV2dG9vbHMvc3VwcmVtZSIKICB1cmwgImh0dHBzOi8vZ2l0aHViLmNvbS9vcGVuZGV2dG9vbHMvc3VwcmVtZS9yZWxlYXNlcy9kb3dubG9hZC92I3t2ZXJzaW9ufS9zdXByZW1lLSN7dmVyc2lvbn0tYWFyY2g2NC1hcHBsZS1kYXJ3aW4udGFyLmd6IgogIHNoYTI1NiAie3tzaGF9fSIKCiAgZGVmIGluc3RhbGwKICAgIGJpbi5pbnN0YWxsICJzdXByZW1lIgogIGVuZAplbmQKCg=="
- name: Update Homebrew formula
working-directory: ./homebrew-supreme
run: |
git config --local user.name github-actions
git config --local user.email github-actions@github.com
cat template.rb | sed -e 's/{{version}}/'"$VERSION"'/g' -e 's/{{sha}}/'"$SHA"'/g' > Formula/supreme.rb
rm template.rb
git commit -am "feat(release): $VERSION"
- name: Push changes
uses: ad-m/github-push-action@master
with:
directory: ./homebrew-supreme
github_token: ${{ secrets.SUPREME_HOMEBREW_PAT }}
branch: main
repository: opendevtools/homebrew-supreme