|
| 1 | +--- |
| 2 | +name: Release |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +jobs: |
| 10 | + semrel: |
| 11 | + name: Semantic Release |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout Repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Semantic Release |
| 18 | + uses: go-semantic-release/action@v1 |
| 19 | + id: semrel |
| 20 | + with: |
| 21 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + allow-initial-development-versions: true |
| 23 | + |
| 24 | + - run: pipx install poetry |
| 25 | + if: steps.semrel.outputs.version != '' |
| 26 | + |
| 27 | + - name: Adjust Versions |
| 28 | + if: steps.semrel.outputs.version != '' |
| 29 | + run: | |
| 30 | + cd api && poetry version ${{ steps.semrel.outputs.version }} && cd - |
| 31 | + cd ember && yarn version --no-commit-hooks --no-git-tag-version --new-version ${{ steps.semrel.outputs.version }} |
| 32 | +
|
| 33 | + - name: Adjust Versions in Chart.yaml |
| 34 | + if: steps.semrel.outputs.version != '' |
| 35 | + |
| 36 | + with: |
| 37 | + cmd: yq eval '(.appVersion = "${{ steps.semrel.outputs.version }}") | (.version = "{{ steps.semrel.outputs.version }}" )' --inplace ./charts/outdated/Chart.yaml |
| 38 | + |
| 39 | + - name: Release Commit |
| 40 | + uses: EndBug/add-and-commit@v9 |
| 41 | + if: steps.semrel.outputs.version != '' |
| 42 | + with: |
| 43 | + message: "chore(release): ${{ steps.semrel.outputs.version }} [skip ci]" |
| 44 | + default_author: github_actions |
| 45 | + add: | |
| 46 | + api/pyproject.toml |
| 47 | + ember/package.json |
| 48 | + charts/outdated/Chart.yaml |
| 49 | +
|
| 50 | + - name: Login to GitHub Container Registry |
| 51 | + uses: docker/login-action@v3 |
| 52 | + if: steps.semrel.outputs.version != '' |
| 53 | + with: |
| 54 | + registry: ghcr.io |
| 55 | + username: ${{ github.actor }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Set up Docker Buildx |
| 59 | + if: steps.semrel.outputs.version != '' |
| 60 | + uses: docker/setup-buildx-action@v3 |
| 61 | + |
| 62 | + - name: Build and Push API Docker Image |
| 63 | + if: steps.semrel.outputs.version != '' |
| 64 | + uses: docker/build-push-action@v5 |
| 65 | + with: |
| 66 | + context: ./api/ |
| 67 | + push: true |
| 68 | + tags: | |
| 69 | + ghcr.io/${{ github.repository }}/api:${{ steps.semrel.outputs.version }} |
| 70 | + ghcr.io/${{ github.repository }}/api:latest |
| 71 | +
|
| 72 | + - name: Build and Push Ember Docker Image |
| 73 | + if: steps.semrel.outputs.version != '' |
| 74 | + uses: docker/build-push-action@v5 |
| 75 | + with: |
| 76 | + context: ./ember/ |
| 77 | + push: true |
| 78 | + tags: | |
| 79 | + ghcr.io/${{ github.repository }}/ember:${{ steps.semrel.outputs.version }} |
| 80 | + ghcr.io/${{ github.repository }}/ember:latest |
| 81 | +
|
| 82 | + - name: Set up Helm |
| 83 | + if: steps.semrel.outputs.version != '' |
| 84 | + |
| 85 | + with: |
| 86 | + version: v3.14.0 |
| 87 | + |
| 88 | + - name: Package Chart |
| 89 | + if: steps.semrel.outputs.version != '' |
| 90 | + run: | |
| 91 | + helm repo add bitnami https://charts.bitnami.com/bitnami |
| 92 | + helm dependency build charts/outdated |
| 93 | + helm package --destination=dist charts/outdated |
| 94 | +
|
| 95 | + - name: Push Chart |
| 96 | + if: steps.semrel.outputs.version != '' |
| 97 | + run: helm push dist/*.tgz oci://ghcr.io/${{ github.repository }}/helm |
0 commit comments