Skip to content

Commit

Permalink
ci(release): dry if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed May 6, 2024
1 parent 23cecc0 commit 9f5af90
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
api:
name: Release API
runs-on: ubuntu-latest
if: needs.semrel.outputs.version != ''
needs: semrel
permissions:
actions: none
Expand All @@ -57,25 +58,21 @@ jobs:
uses: actions/checkout@v4

- name: Adjust Version
if: needs.semrel.outputs.version != ''
run: |
sed 's/"0.0.0"/"${{ needs.semrel.outputs.version }}"/g' -i ./api/pyproject.toml
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: needs.semrel.outputs.version != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
if: needs.semrel.outputs.version != ''
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
if: needs.semrel.outputs.version != ''
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/api
Expand All @@ -94,7 +91,6 @@ jobs:
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Build and Push API Docker Image
if: needs.semrel.outputs.version != ''
uses: docker/build-push-action@v5
id: docker
with:
Expand All @@ -105,7 +101,6 @@ jobs:
${{ steps.meta.outputs.labels }}
- name: Sign api image and attach SBOM attestation
if: needs.semrel.outputs.version != ''
uses: adfinis/container-scanning-action@v0.2.3
with:
image-ref: ghcr.io/${{ github.repository }}/api
Expand All @@ -115,6 +110,7 @@ jobs:
ember:
name: Release frontend
runs-on: ubuntu-latest
if: needs.semrel.outputs.version != ''
needs: semrel
permissions:
actions: none
Expand All @@ -134,25 +130,21 @@ jobs:
uses: actions/checkout@v4

- name: Adjust Version
if: needs.semrel.outputs.version != ''
run: |
sed 's/"0.0.0"/"${{ needs.semrel.outputs.version }}"/g' -i ./ember/package.json
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: needs.semrel.outputs.version != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
if: needs.semrel.outputs.version != ''
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
if: needs.semrel.outputs.version != ''
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/ember
Expand All @@ -171,7 +163,6 @@ jobs:
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Build and Push
if: needs.semrel.outputs.version != ''
uses: docker/build-push-action@v5
id: docker
with:
Expand All @@ -182,7 +173,6 @@ jobs:
${{ steps.meta.outputs.labels }}
- name: Sign image and attach SBOM attestation
if: needs.semrel.outputs.version != ''
uses: adfinis/container-scanning-action@v0.2.3
with:
image-ref: ghcr.io/${{ github.repository }}/ember
Expand All @@ -193,6 +183,7 @@ jobs:
chart:
name: Release Helm Chart
runs-on: ubuntu-latest
if: needs.semrel.outputs.version != ''
needs:
- api
- ember
Expand All @@ -215,31 +206,26 @@ jobs:
uses: actions/checkout@v4

- name: Adjust Version
if: needs.semrel.outputs.version != ''
run: |
sed -r 's/"(0.0.0|latest)"/"${{ needs.semrel.outputs.version }}"/g' -i ./charts/outdated/Chart.yaml
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: needs.semrel.outputs.version != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Helm
if: needs.semrel.outputs.version != ''
uses: azure/setup-helm@v4
with:
version: v3.14.0

- name: Package Chart
if: needs.semrel.outputs.version != ''
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build charts/outdated
helm package --destination=dist charts/outdated
- name: Push Chart
if: needs.semrel.outputs.version != ''
run: helm push dist/*.tgz oci://ghcr.io/${{ github.repository }}/helm

0 comments on commit 9f5af90

Please sign in to comment.