|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ["v*"] |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + |
| 10 | +jobs: |
| 11 | + image: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + packages: write |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - uses: docker/setup-buildx-action@v3 |
| 19 | + - uses: docker/login-action@v3 |
| 20 | + with: |
| 21 | + registry: ghcr.io |
| 22 | + username: ${{ github.actor }} |
| 23 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + - id: meta |
| 25 | + uses: docker/metadata-action@v5 |
| 26 | + with: |
| 27 | + images: ghcr.io/${{ github.repository }} |
| 28 | + tags: | |
| 29 | + type=semver,pattern={{version}} |
| 30 | + type=semver,pattern={{major}}.{{minor}} |
| 31 | + - uses: docker/build-push-action@v6 |
| 32 | + with: |
| 33 | + context: . |
| 34 | + push: true |
| 35 | + tags: ${{ steps.meta.outputs.tags }} |
| 36 | + labels: ${{ steps.meta.outputs.labels }} |
| 37 | + cache-from: type=gha |
| 38 | + cache-to: type=gha,mode=max |
| 39 | + |
| 40 | + github-release: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: image |
| 43 | + permissions: |
| 44 | + contents: write |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + - uses: dtolnay/rust-toolchain@stable |
| 48 | + - uses: Swatinem/rust-cache@v2 |
| 49 | + - name: Build release binary |
| 50 | + run: | |
| 51 | + cargo build --release --bin rustfs-operator |
| 52 | + cp target/release/rustfs-operator rustfs-operator-linux-amd64 |
| 53 | + - uses: softprops/action-gh-release@v2 |
| 54 | + with: |
| 55 | + generate_release_notes: true |
| 56 | + files: | |
| 57 | + deploy/crds.yaml |
| 58 | + rustfs-operator-linux-amd64 |
| 59 | +
|
| 60 | + charts: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: image |
| 63 | + permissions: |
| 64 | + contents: write |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + fetch-depth: 0 |
| 69 | + - name: Set chart version from tag |
| 70 | + run: | |
| 71 | + version="${GITHUB_REF_NAME#v}" |
| 72 | + sed -i "s/^version:.*/version: ${version}/" charts/rustfs-operator/Chart.yaml |
| 73 | + sed -i "s/^appVersion:.*/appVersion: \"${version}\"/" charts/rustfs-operator/Chart.yaml |
| 74 | + - name: Configure git |
| 75 | + run: | |
| 76 | + git config user.name "$GITHUB_ACTOR" |
| 77 | + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" |
| 78 | + - name: Release chart to gh-pages |
| 79 | + uses: helm/chart-releaser-action@v1 |
| 80 | + with: |
| 81 | + charts_dir: charts |
| 82 | + mark_as_latest: false |
| 83 | + env: |
| 84 | + CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments