Skip to content

Fix GH action's versions #73

Fix GH action's versions

Fix GH action's versions #73

Workflow file for this run

name: cicd
on:
push:
branches:
- development
- master
pull_request:
branches:
- development
- master
jobs:
test:
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: docker compose -f docker-compose.test.yml up --exit-code-from test
build:
runs-on: ubuntu-20.04
env:
SKAFFOLD_DEFAULT_REPO: ghcr.io/con2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pairity/setup-cd-tools@30acb848f9ff747aff4810dac40c5cc0971f485d
with:
skaffold: '1.20.0'
- uses: docker/login-action@v3
if: ${{ github.event_name == 'push' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PASSWORD }}
- uses: docker/setup-buildx-action@v3
- id: build
run: |
python3 -m pip install emskaffolden
# Do not push to registry on pull request events
if [ "${{ github.event_name }}" = pull_request ]; then
EMSKAFFOLDEN_ENV=pull_request
else
EMSKAFFOLDEN_ENV=default
fi
emskaffolden -E "$EMSKAFFOLDEN_ENV" -- build --file-output build.json
echo "::set-output name=build_json::$(base64 -w 0 < build.json)"
outputs:
build_json: ${{ steps.build.outputs.build_json }}
# TODO DRY
deploy_staging:
runs-on: self-hosted
needs: build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pairity/setup-cd-tools@30acb848f9ff747aff4810dac40c5cc0971f485d
with:
kubectl: '1.20.4'
skaffold: '1.20.0'
- uses: docker/setup-buildx-action@v3
- run: |
python3 -m pip install emskaffolden
base64 -d <<< "${{ needs.build.outputs.build_json }}" > build.json
emskaffolden -E staging -- deploy -n kirppu-staging -a build.json
deploy_production:
runs-on: self-hosted
needs: build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pairity/setup-cd-tools@30acb848f9ff747aff4810dac40c5cc0971f485d
with:
kubectl: '1.20.4'
skaffold: '1.20.0'
- uses: docker/setup-buildx-action@v3
- run: |
python3 -m pip install emskaffolden
base64 -d <<< "${{ needs.build.outputs.build_json }}" > build.json
emskaffolden -E production -- deploy -n kirppu -a build.json