Merge pull request #13 from magda-io/issue/12 #217
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: Main CI Workflow | |
on: push | |
env: | |
REPO_NAME: magda-ckan-connector | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-test-docker: | |
name: Build, Test & Push to Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set helm to v3.12.3 | |
shell: bash | |
run: | | |
sudo rm /usr/local/bin/helm | |
sudo curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > /tmp/helm.sh | |
sudo chmod +x /tmp/helm.sh | |
sudo /tmp/helm.sh --version v3.12.3 | |
helm version | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 14 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- run: yarn install | |
- run: yarn build | |
- run: yarn test | |
- name: helm-build-dependencies | |
run: helm dep up deploy/${REPO_NAME} | |
- run: yarn helm-lint | |
- name: Check Helm Chart Document | |
run: | | |
code=0 | |
docker run --rm -v "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:v1.11.2 -t ./README.md.gotmpl -o ../../README.md || code=$?; | |
if [ "$code" != "0" ]; then | |
echo "Failed to run helm-docs!"; | |
exit 1; | |
fi; | |
cd deploy | |
code=0 | |
git ls-files -m | grep -i readme.md || code=$?; | |
if [ "$code" == "0" ]; then | |
echo -e "Some of helm chart docs are required to be updated using the [helm-docs](https://github.com/norwoodj/helm-docs) tool. \n | |
Please run helm-docs (v1.11.2) at project root, review & commit docs changes and push a new commit."; | |
exit 1; | |
else | |
echo -e "helm docs check passed. helm docs update is not required."; | |
fi; | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Package Repository | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build Docker Image & Push to Github Container Registry | |
run: | | |
REPO_OWNER=`echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]'` | |
yarn docker-build-prod --repository=ghcr.io/${REPO_OWNER} --name=${REPO_NAME} --version=${GITHUB_SHA} --platform=linux/amd64,linux/arm64 |