Skip to content

Commit

Permalink
ci: update github actions and move docker user name to vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele-Alberti committed Jan 27, 2024
1 parent 398cf63 commit 0f1b74f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/ci_cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -58,7 +58,7 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -74,14 +74,15 @@ jobs:

environment:
name: release
url: https://github.com/Michele-Alberti/data-lunch/releases

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand Down Expand Up @@ -127,22 +128,22 @@ jobs:
with:
ref: main
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/web/Dockerfile.web
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:stable
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache,mode=max
tags: ${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:stable
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache,mode=max

# If on development just publish to TestPyPI
# Build the package for TestPyPI
Expand All @@ -157,7 +158,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
Expand All @@ -174,7 +175,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -194,7 +195,7 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/manual_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/web/Dockerfile.web
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:${{ github.event.inputs.tag }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache,mode=max
tags: ${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:${{ github.event.inputs.tag }}
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_USERNAME }}/data-lunch-app:buildcache,mode=max

0 comments on commit 0f1b74f

Please sign in to comment.