name: ${{ github.actor }} executed Build Push Prod on: push: tags: - 'v[0-9]+\.[0-9]+\.[0-9]+' jobs: build: runs-on: ubuntu-latest env: TOKEN: ${{ secrets.TOKEN }} USERNAME: ${{ vars.USERNAME }} TAG_VERSION: ${{ github.ref_name }} GOPROXY: direct steps: - name: echo repo dir id: repo-url run: | echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT - name: Checkout code uses: actions/checkout@v4 - name: Setup Quemu uses: docker/setup-qemu-action@v3 - name: Set Up BuildX uses: docker/setup-buildx-action@v3 - name: Login to Docker uses: docker/login-action@v3 with: registry: ${{ github.server_url }} username: ${{ vars.USERNAME }} password: ${{ secrets.PWD }} - name: calculate short sha id: calculate-sha run: | echo "shortsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build and push uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" build-args: | version=${{ github.ref_name }} SHORTSHA=${{ steps.calculate-sha.outputs.shortsha }} deploy: runs-on: ubuntu-latest needs: build env: TOKEN: ${{ secrets.TOKEN }} TAG: ${{ github.ref_name }} PASSWORD: $PWD USERNAME: ${{ vars.USERNAME }} TAG_VERSION: ${{ github.ref_name }} NATS_SERVICE_URL: "${{ vars.NATS_SERVICE_URL }}" ENV: "production" APPLICATION_PORT: "${{ vars.APPLICATION_PORT }}" DATA_SOURCE_URL: "${{ vars.DATA_SOURCE_URL }}" DOLLAR_SERVICE_URL: "${{ vars.DOLLAR_SERVICE_URL }}" APA: "${{ vars.APA }}" ACAP: "${{ vars.ACAP }}" ANAP: "${{ vars.ANAP }}" BCCRB: "${{ vars.BCCRB }}" BCD: "${{ vars.BCD }}" BDR: "${{ vars.BDR }}" BHD: "${{ vars.BHD }}" BNC: "${{ vars.BNC }}" BNSC: "${{ vars.BNSC }}" BPD: "${{ vars.BPD }}" GENERAL: "${{ vars.GENERAL }}" SCOTIA: "${{ vars.SCOTIA }}" VIMECA: "${{ vars.VIMENCA }}" steps: - name: echo repo dir id: repo-url run: | echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT echo "repoName=$(echo ${{ github.repository }} | sed -e 's;${{ github.actor }}/;;')" >> $GITHUB_OUTPUT - name: Checkout code uses: actions/checkout@v4 - name: install envsubst run: | apt update apt install -y gettext-base apt clean - name: create deployment files env: IMAGE: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" REPONAME: "${{ steps.repo-url.outputs.repoName }}" run: | envsubst < k8s/cronjobs.yml.template > k8s/cronjobs.yml - name: Download kubectl run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - name: install kubectl run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl - name: insert kube config env: REPONAME: "${{ steps.repo-url.outputs.repoName }}" run: | mkdir ~/.kube export IMAGE="$( echo ${{ github.server_url }} | sed -e 's;https://;;')/${{ github.repository }}:${{ github.ref_name }}" echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config - name: apply config run: kubectl apply -f k8s/cronjobs.ymlf