Update versions of github actions #212
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: push | |
env: | |
PROJECT_ID: ${{ secrets.RUN_PROJECT }} | |
RUN_REGION: europe-west3 | |
PROJECT_BASE_URL: https://qawareblog-2ixogl4y4q-ey.a.run.app/ | |
DOCKER_GAR_NAME: qaware-blog-docker | |
SERVICE_NAME: qawareblog | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup composed environment variables | |
run: | | |
echo "DOCKER_IMAGE_PATH=${RUN_REGION}-docker.pkg.dev/${PROJECT_ID}/${DOCKER_GAR_NAME}/${SERVICE_NAME}:${GITHUB_SHA}" >> $GITHUB_ENV | |
echo "DOCKER_REGISTRY_BASE_URL=${RUN_REGION}-docker.pkg.dev" >> $GITHUB_ENV | |
- name: Setup hugo | |
uses: peaceiris/actions-hugo@v2.6.0 | |
with: | |
hugo-version: "0.133.0" | |
extended: true | |
- name: Build | |
run: hugo -s . --config ./config.toml --minify --cleanDestinationDir | |
- name: Deploy | |
if: github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
personal_token: ${{ secrets.TOKEN }} | |
external_repository: qaware/qaware.github.io | |
publish_dir: ./public | |
#keep_files: true | |
user_name: fuchshuber | |
user_email: josef.fuchshuber@qaware.de | |
publish_branch: master | |
cname: blog.qaware.de | |
# Setup gcloud CLI | |
- name: 'Setup Cloud Auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.RUN_SA_KEY }} | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
with: | |
project_id: ${{ secrets.RUN_PROJECT }} | |
# Configure docker to use the gcloud command-line tool as a credential helper | |
- run: gcloud auth configure-docker $DOCKER_REGISTRY_BASE_URL | |
# Build the Docker image for staging environment | |
- name: Build | |
run: docker build --build-arg BASE_URL=$PROECT_BASE_URL --tag $DOCKER_IMAGE_PATH . | |
# Push the Docker image to Google Artifact Registry | |
- name: Publish | |
run: docker push $DOCKER_IMAGE_PATH | |
# Deploy the Docker image to Google Cloud Run | |
- name: Deploy | |
run: gcloud components install beta && gcloud beta run deploy $SERVICE_NAME --quiet --image $DOCKER_IMAGE_PATH --project $PROJECT_ID --region $RUN_REGION --platform managed --allow-unauthenticated |