Skip to content

fix: deploy to stacks enabled #2

fix: deploy to stacks enabled

fix: deploy to stacks enabled #2

Workflow file for this run

name: Release Flask to Stacks
on:
workflow_call:
inputs:
cache_paths:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
default: prod
elixir-code-path:
type: string
required: false
default: "."
stacks-repo:
type: string
required: false
default: "git@github.com:coingaming/stacks.git"
stacks-name:
type: string
required: false
default: ${{ inputs.app-name }}
stacks-branch-name:
type: string
required: false
default: ${{ inputs.app-name }}
app-name:
type: string
required: true
app-vsn:
type: string
required: true
service-name:
type: string
required: false
default: ${{ inputs.app-name }}
docker-org:
type: string
required: false
default: heathmont
secrets:
HEX_ORGANIZATION_COINGAMING_KEY:
required: true
defaults:
run:
shell: bash
env:
MIX_ENV: ${{ inputs.mix-env }}
jobs:
build:
name: Build
uses: coingaming/.github/.github/workflows/build.yml@main
secrets: inherit
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}
release:
name: Release
needs: build
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: ${{ inputs.elixir-code-path }}
env:
MIX_ENV: ${{ inputs.mix-env }}
HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_COINGAMING_KEY }}
APP_NAME: ${{ inputs.app-name }}
APP_VSN: ${{ inputs.app-vsn }}
steps:
- name: Prepare repo and env
uses: coingaming/.github/actions/prepare@main
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}
# - name: Use Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 20.10.0
- name: Add NPM Registry
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Auhtorize github.com
env:

Check failure on line 110 in .github/workflows/release-flask.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release-flask.yml

Invalid workflow file

You have an error in your yaml syntax on line 110
GH_PAT: ${{ secrets.GH_TOKEN }}
GIT_TERMINAL_PROMPT: 0
run: |
git config --global --replace-all url."https://${GH_PAT}@github.com/".insteadOf git@github.com:
# git config --global --add url."https://${GH_PAT}@github.com/".insteadOf "https://github.com/"
- name: Get & build for asset
run: |
mix assets.setup
mix assets.deploy
mix assets.clean
- name: Build release
run: |
mix release
cp _build/${{ env.MIX_ENV }}/${{ env.APP_NAME }}-${{ env.APP_VSN }}.tar.gz ./release.tar.gz
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Prepare variables for push
run: echo "IMAGE=${{ inputs.docker-org }}/$APP_NAME:v${APP_VSN}-${GITHUB_SHA::9}" >> $GITHUB_ENV
- name: Build and Push Docker Image
run: |
docker build \
--build-arg MIX_ENV=${{ env.MIX_ENV }} \
--build-arg APP_NAME=${{ env.APP_NAME }} \
-t ${{ env.IMAGE }} \
--file ci.Dockerfile .
docker push ${{ env.IMAGE }}
- name: Deploy to stacks
run: |
git clone git@github.com:coingaming/${{ inputs.stacks-repo }}
cd ${{ inputs.stacks-repo }}
git checkout ${{ inputs.stacks-branch-name }}
scripts/update-image ${{ inputs.stacks-name }} ${{inputs.service-name }} ${{ env.IMAGE }}
git commit -am "upgraded ${{inputs.service-name }} service with ${{ env.IMMAGE }}"
git push origin refs/heads/${{ inputs.stacks-branch-name }}:refs/heads/${{ inputs.stacks-branch-name }}