Skip to content

Commit

Permalink
Fix and update deprecated Github actions (#4327)
Browse files Browse the repository at this point in the history
* fix CI
  • Loading branch information
submarcos authored Oct 9, 2024
1 parent 4fd47b5 commit 8abe56a
Showing 1 changed file with 47 additions and 21 deletions.
68 changes: 47 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ jobs:
path: |
./venv
key: pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }}
key: pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt') }}-${{ hashFiles('./dev-requirements.txt') }}-${{ hashFiles('./docs/requirements.txt') }}
restore-keys: |
pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }}
pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt') }}-${{ hashFiles('./dev-requirements.txt') }}-${{ hashFiles('./docs/requirements.txt') }}
pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt') }}-${{ hashFiles('./dev-requirements.txt') }}
pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt') }}
pip-${{ matrix.os }}
- name: Prepare test env
Expand Down Expand Up @@ -191,17 +193,26 @@ jobs:

build_docker_image:
name: Build docker image
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: |
docker build -f ./docker/Dockerfile -t geotrek:latest .

- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: false
builder: ${{ steps.buildx.outputs.name }}
tags: "geotrek:latest"
load: true
file: ./docker/Dockerfile

- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
uses: ishworkh/container-image-artifact-upload@v2.0.0
with:
image: "geotrek:latest"

Expand Down Expand Up @@ -263,12 +274,15 @@ jobs:
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "geotrek:latest"

- name: Launch service
run: |
docker tag geotrek:latest geotrekce/admin:latest
Expand Down Expand Up @@ -349,7 +363,7 @@ jobs:
--health-cmd pg_isready
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: 'focal'
Expand Down Expand Up @@ -414,30 +428,28 @@ jobs:
needs: [ test, e2e_docker_image, build_deb, e2e_deb_20_04 ]
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download 18.04 debian artifact
uses: actions/download-artifact@v4
with:
name: bionic

- name: Download 20.04 debian artifact
uses: actions/download-artifact@v4
with:
name: debian-20-04
name: focal

- name: Download docker image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: focal
- name: Attach debian packages as release binaries
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ishworkh/[email protected]
with:
args: '*.deb'
image: 'geotrek:latest'

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Publish Docker image (v2 and latest)
run: |
if [[ "${{ github.ref }}" == *"dev"* ]]; then
Expand All @@ -449,11 +461,13 @@ jobs:
fi
docker tag geotrek:latest geotrekce/admin:$DOCKER_TAG
docker push geotrekce/admin:$DOCKER_TAG
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

- name: Publish debian packages
run: |
if [[ "${{ github.ref }}" == *"dev"* ]]; then
Expand All @@ -470,3 +484,15 @@ jobs:
ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make bionic_main -C /srv/packages
ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make focal_main -C /srv/packages
fi
- name: Download 22.04 debian artifact
uses: actions/download-artifact@v4
with:
name: jammy

- name: Attach debian packages as release binaries
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: '*.deb'

0 comments on commit 8abe56a

Please sign in to comment.