Skip to content

Commit

Permalink
Fix action for saving artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsierro committed Jan 17, 2024
1 parent 25668b8 commit 7e54606
Showing 1 changed file with 15 additions and 37 deletions.
52 changes: 15 additions & 37 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

jobs:
test:

runs-on: ubuntu-latest

steps:
Expand All @@ -32,44 +31,23 @@ jobs:
pip install pytest
python manage.py test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build docker image for web
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.prod
tags: ghcr.io/alexsierro/fabman/web:latest
outputs: type=oci,dest=/tmp/myimage.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: myimage
path: /tmp/myimage.tar


deploy:
build-push-image:
runs-on: ubuntu-latest
needs: build
needs: test
if: github.ref == 'refs/heads/main'

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: myimage
path: /tmp
- name: Load image
run: |
docker load --input /tmp/myimage.tar
docker image ls -a
- name: Push image
run: |
docker image push ghcr.io/alexsierro/fabman/web:latest
- uses: actions/checkout@v2

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

- name: 'Build Web Image'
run: |
docker build . --tag ghcr.io/alexsierro/fabman/web:latest -f Dockerfile.prod
docker push ghcr.io/alexsierro/fabman/web:latest

0 comments on commit 7e54606

Please sign in to comment.