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