CI #247
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
types: [opened, reopened] | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '30 15 * * *' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
APP_NAME: formsg-intl | |
steps: | |
- name: Checkout opengovsg/FormSG into the same local dir | |
uses: actions/checkout@v4 | |
with: | |
repository: opengovsg/FormSG | |
ref: refs/heads/release-al2 | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
with: | |
path: repo | |
- name: Move repo contents into local root | |
run: mv repo/* . | |
- name: Replace files with intl-specific ones | |
run: | | |
cp -rf replacements/* . | |
rm -rf replacements | |
- run: ls -al frontend | |
- name: Substitute index.html OG params | |
run: | | |
cat frontend/public/index.html | \ | |
sed 's/__OG_TITLE__/Form/' | \ | |
sed 's/__OG_DESCRIPTION__/Secure forms from the government/' | \ | |
sed 's/__OG_IMAGE__/og-img-metatag-publicform.png/' > frontend/public/index2.html && \ | |
mv frontend/public/index2.html frontend/public/index.html | |
- name: Set app version | |
run: | | |
echo "APP_VERSION=$(jq -r .version package.json)-$(echo ${GITHUB_REF##*/})-$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
tags: | | |
opengovsg/${{ env.APP_NAME }}:latest | |
opengovsg/${{ env.APP_NAME }}:${{ env.APP_VERSION }} |