Skip to content

Commit

Permalink
ci: update workflow actions
Browse files Browse the repository at this point in the history
  • Loading branch information
derlin committed Aug 4, 2024
1 parent 12dbbdd commit 136347b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

Expand All @@ -31,7 +31,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand Down Expand Up @@ -60,4 +60,4 @@ jobs:
${{ github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }}
publish_dockerhub: >-
${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
14 changes: 7 additions & 7 deletions .github/workflows/deploy-cloud-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- name: Setup vars
id: vars
run: |
echo "::set-output name=service::${{ github.event.inputs.service }}"
echo "::set-output name=tag::${{ github.event.inputs.tag }}"
echo "name=service::${{ github.event.inputs.service }}" >> $GITHUB_OUTPUT
echo "name=tag::${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
- name: Authenticate to Google Cloud
id: auth
Expand All @@ -32,13 +32,13 @@ jobs:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'

- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2

- name: Authorize Docker push
run: gcloud auth configure-docker

- name: Login to Docker Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -50,7 +50,7 @@ jobs:
image=ghcr.io/${{ github.repository }}
docker pull $image:${{ steps.vars.outputs.tag }}
echo "::set-output name=img::$image"
echo "name=img::$image" >> $GITHUB_OUTPUT
- name: Push Docker Image
id: push
Expand All @@ -61,11 +61,11 @@ jobs:
docker tag ${{ steps.pull.outputs.img }} $image:$tag
docker push $image:$tag
echo "::set-output name=img::$image:$tag"
echo "name=img::$image:$tag" >> $GITHUB_OUTPUT
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v1
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ steps.vars.outputs.service }}
image: ${{ steps.push.outputs.img }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/reusable_docker-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
name: Docker Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Extract Docker metadata for Docker Hub
if: ${{ inputs.publish && inputs.publish_dockerhub }}
id: meta_dockerhub
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: docker.io/${{ github.repository }}
tags: |
Expand Down Expand Up @@ -81,27 +81,27 @@ jobs:
container_user: 1000 # UID to run the container under to prevent permission issues

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
if: ${{ inputs.publish && inputs.publish_dockerhub }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64 # also support the new mac architecture (requires buildx)
Expand All @@ -111,4 +111,4 @@ jobs:
# use layer caching. Don't forget mode=max to also cache the build image
# (vs only the final image - mode: min)
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max

0 comments on commit 136347b

Please sign in to comment.