Add copy to clipboard #43
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: Production CI | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }} | |
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AIRTABLE_APP: ${{ secrets.AIRTABLE_APP }} | |
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' | |
- name: npm requirements | |
run: npm install --legacy-peer-deps | |
- name: pip requirements | |
run: pip install -r tools/requirements.txt | |
- name: git identity | |
run: | | |
git config user.email "adam.kariv@gmail.com" | |
git config user.name "Adam Kariv" | |
- name: Build | |
run: | | |
python tools/process.py | |
npm run build | |
- name: Build Docker Image and push to GitHub Container Registry | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HASADNA_K8S_DEPLOY_KEY: ${{ secrets.HASADNA_K8S_DEPLOY_KEY }} | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
DOCKER_IMAGE_NAME=ghcr.io/${{ github.repository }} | |
docker build -t img . | |
docker tag img "${DOCKER_IMAGE_NAME}:latest" | |
docker push "${DOCKER_IMAGE_NAME}:latest" | |
docker tag img "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" | |
docker push "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" | |
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; then | |
cd `mktemp -d` &&\ | |
echo "${HASADNA_K8S_DEPLOY_KEY}" > hasadna_k8s_deploy_key &&\ | |
chmod 400 hasadna_k8s_deploy_key &&\ | |
export GIT_SSH_COMMAND="ssh -i `pwd`/hasadna_k8s_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\ | |
git clone git@github.com:hasadna/hasadna-k8s.git &&\ | |
cd hasadna-k8s &&\ | |
python update_yaml.py '{"webImage":"'"${DOCKER_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/treecatalog/values-hasadna-auto-updated.yaml &&\ | |
git config --global user.name "Treecatalog CI" &&\ | |
git config --global user.email "treecatalog-ci@localhost" &&\ | |
git add apps/treecatalog/values-hasadna-auto-updated.yaml && git commit -m "automatic update of treecatalog" &&\ | |
git push origin master | |
fi |