Merge pull request #165 from influxdata/chore/dependency-updates #420
This file contains 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
name: Rust | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3 | |
- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2 | |
- name: Build | |
run: cargo build | |
- name: Format | |
run: | | |
cargo fmt | |
test -z "$(git status --porcelain)" || (echo 'Changes detected after running cargo fmt'; git status; git --no-pager diff; false) | |
- name: Generate | |
run: | | |
cargo run -- manifests > manifests/crd.yml | |
test -z "$(git status --porcelain)" || (echo 'Changes detected after generating manifests'; git status; git --no-pager diff; false) | |
- name: Run tests | |
run: cargo test | |
pack: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
# Allows pushing to the GitHub Container Registry | |
packages: write | |
steps: | |
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3 | |
- uses: depot/setup-action@v1 | |
- name: Login to GHCR | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2 | |
with: | |
registry: us-docker.pkg.dev | |
username: _json_key | |
password: ${{ secrets.GAR_JSON_KEY }} | |
if: github.event_name != 'pull_request' | |
- run: | | |
echo "LAST_COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Build | |
uses: depot/build-push-action@v1 | |
with: | |
context: . | |
project: gg0kz3d1l3 | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
tags: us-docker.pkg.dev/influxdb2-artifacts/tubernetes/sinker:${{ env.LAST_COMMIT_SHA }} | |
if: github.event_name == 'pull_request' | |
- name: Build & Push | |
uses: depot/build-push-action@v1 | |
with: | |
context: . | |
project: gg0kz3d1l3 | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: us-docker.pkg.dev/influxdb2-artifacts/tubernetes/sinker:${{ env.LAST_COMMIT_SHA }} | |
if: github.event_name != 'pull_request' |