[FIX] Remove extra contents #257
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: deploy | |
on: | |
push: | |
branches: | |
- "main" | |
- "next" | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
RELEASE_NAME: trader4-web | |
RELEASE_NAMESPACE: trader4-web | |
RELEASE_DOMAIN: trader4.net | |
NEXT_RELEASE_DOMAIN: next.trader4.net | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Lint Helm | |
uses: WyriHaximus/github-action-helm3@v3 | |
with: | |
exec: helm lint .ci/chart | |
build: | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Lowecase the repo name | |
run: | | |
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Declare short commit id | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: "Set IMG_NAME variable" | |
run: echo 'IMG_NAME=ghcr.io/${{ env.REPOSITORY_NAME }}' >>$GITHUB_ENV | |
- name: "Set IMG_TAG variable" | |
run: echo 'IMG_TAG=${{ env.BRANCH_NAME }}-${{ steps.vars.outputs.sha_short }}' >>$GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: login to ghcr.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USER }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ env.IMG_NAME }}:${{ env.IMG_TAG }} | |
helm: | |
needs: [build] | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Lowecase the repo name | |
run: | | |
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Declare short commit id | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: "Set IMG_NAME variable" | |
run: echo 'IMG_NAME=ghcr.io/${{ env.REPOSITORY_NAME }}' >>$GITHUB_ENV | |
- name: "Set IMG_TAG variable" | |
run: echo 'IMG_TAG=${{ env.BRANCH_NAME }}-${{ steps.vars.outputs.sha_short }}' >>$GITHUB_ENV | |
- name: "Set RELEASE_DOMAIN to next if branch is next" | |
if: env.BRANCH_NAME == 'next' | |
run: echo 'RELEASE_DOMAIN=${{ env.NEXT_RELEASE_DOMAIN }}' >>$GITHUB_ENV | |
- name: "Set RELEASE_NAME if to next branch is next" | |
if: env.BRANCH_NAME == 'next' | |
run: echo 'RELEASE_NAME=next-${{ env.RELEASE_NAME }}' >>$GITHUB_ENV | |
- name: Run Helm and Deploy | |
uses: WyriHaximus/github-action-helm3@v3 | |
with: | |
exec: | | |
helm upgrade --install \ | |
"${{ env.RELEASE_NAME }}.${{ env.BRANCH_NAME }}" \ | |
--namespace ${{ env.RELEASE_NAMESPACE }} \ | |
--set name="${{ env.RELEASE_NAME }}" \ | |
--set domainName="${{ env.RELEASE_DOMAIN }}" \ | |
--set image.repository="${{ env.IMG_NAME }}" \ | |
--set image.tag="${{ env.IMG_TAG }}" \ | |
--set tls.enabled="true" \ | |
--set tls.clusterIssuer="cf-letsencrypt" \ | |
--set tls.secretName="${{ env.BRANCH_NAME }}-${{ env.RELEASE_NAME }}-net-tls" \ | |
--create-namespace \ | |
--atomic \ | |
.ci/chart | |
kubeconfig: '${{ secrets.KUBECONFIG }}' | |