-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
138 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'Environment variables setup' | ||
description: 'Sets up environment variables for workflows' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Define variables | ||
shell: bash | ||
run: | | ||
( | ||
SHA=${GITHUB_SHA::7} | ||
DOCKER_REGISTRY=mtz.ocir.io | ||
echo "DOCKER_REPO=${DOCKER_REGISTRY}/${{ secrets.OCI_TENANCY_NAMESPACE }}/movie-info-bot" | ||
echo "SHA=${SHA}" | ||
echo "HOST=${{ secrets.HOST }}" | ||
echo "TELEGRAM_API_TOKEN=${{ secrets.TELEGRAM_API_TOKEN }}" | ||
echo "DOCKER_REGISTRY=${DOCKER_REGISTRY}" | ||
echo "DOCKER_USERNAME=${{ secrets.OCI_TENANCY_NAMESPACE }}/${{ secrets.OCI_USERNAME }}" | ||
echo "DOCKER_AUTH_TOKEN=${{ secrets.DOCKER_AUTH_TOKEN }}" | ||
) >> $GITHUB_ENV |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Deploy on push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DOCKER_REGISTRY: mtz.ocir.io | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environment variables | ||
uses: allenevans/set-env@v3.0.0 | ||
with: | ||
DOCKER_REPO: '${{ env.DOCKER_REGISTRY }}/${{ secrets.OCI_TENANCY_NAMESPACE }}/movie-info-bot' | ||
DOCKER_USERNAME: '${{ secrets.OCI_TENANCY_NAMESPACE }}/${{ secrets.OCI_USERNAME }}' | ||
|
||
- name: Get short SHA | ||
run: echo "SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
|
||
- name: Login to Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ env.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v3 | ||
|
||
# - name: Build and push | ||
# uses: docker/build-push-action@v5 | ||
# with: | ||
# push: true | ||
# platforms: linux/arm64 | ||
# tags: | | ||
# ${{ env.DOCKER_REPO }}:latest | ||
# ${{ env.DOCKER_REPO }}:${{ env.SHA }} | ||
|
||
- name: Docker build | ||
run: docker build --platform linux/arm64 . -t ${{ env.DOCKER_REPO }}:latest | ||
|
||
- name: Docker tag | ||
run: docker tag ${{ env.DOCKER_REPO }}:latest ${{ env.DOCKER_REPO }}:${{ env.SHA }} | ||
|
||
- name: Docker push | ||
run: docker push ${{ env.DOCKER_REPO }} --all-tags | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
env: | ||
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} | ||
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} | ||
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} | ||
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} | ||
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environment variables | ||
uses: allenevans/set-env@v3.0.0 | ||
with: | ||
DOCKER_REPO: '${{ env.DOCKER_REGISTRY }}/${{ secrets.OCI_TENANCY_NAMESPACE }}/movie-info-bot' | ||
DOCKER_USERNAME: '${{ secrets.OCI_TENANCY_NAMESPACE }}/${{ secrets.OCI_USERNAME }}' | ||
DOCKER_AUTH_TOKEN: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
HOST: ${{ secrets.HOST }} | ||
TELEGRAM_API_TOKEN: ${{ secrets.TELEGRAM_API_TOKEN }} | ||
|
||
- name: Get short SHA | ||
run: echo "SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
|
||
- name: Configure Kubectl and kubeconfig | ||
uses: oracle-actions/configure-kubectl-oke@v1.3.2 | ||
with: | ||
cluster: ${{ secrets.OKE_CLUSTER_OCID }} | ||
|
||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
|
||
- name: Modify values.yaml | ||
run: 'envsubst < ./.helm/template-values.yaml > ./.helm/values.yaml' | ||
|
||
- name: View modified yaml | ||
run: cat ./.helm/values.yaml | ||
|
||
- name: Helm upgrade | ||
run: helm upgrade -f .helm/values.yaml movie-info-bot ./.helm --atomic --debug --reuse-values --namespace movie-info-bot |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
appName: movie-info-bot | ||
|
||
deployment: | ||
image: '${DOCKER_REPO}:${SHA}' | ||
sha: '${SHA}' | ||
|
||
ingress: | ||
host: '${HOST}' | ||
|
||
appEnv: | ||
apiToken: '${TELEGRAM_API_TOKEN}' | ||
|
||
imageCredentials: | ||
registry: '${DOCKER_REGISTRY}' | ||
username: '${DOCKER_USERNAME}' | ||
password: '${DOCKER_AUTH_TOKEN}' |
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
This file was deleted.
Oops, something went wrong.