From bcd3a82f58314ded6b7ba4183b868d62df040bef Mon Sep 17 00:00:00 2001 From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:29:40 +1000 Subject: [PATCH] ci: Refactor GitHub actions and Makefile targets - Refactored GitHub workflows to separate publishing tasks into 'publish-package' and 'publish-image' - Reorganized Makefile to include targets for pushing both packages and images - Updated Docker image for the 'app' service in compose.yaml --- .github/workflows/publish-image.yaml | 24 ++++++++++++++++++++++++ .github/workflows/publish-package.yaml | 18 ++++++++++++++++++ .github/workflows/publish.yaml | 14 ++++---------- .github/workflows/version.yaml | 2 +- Makefile | 5 ++++- compose.yaml | 1 + 6 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/publish-image.yaml create mode 100644 .github/workflows/publish-package.yaml diff --git a/.github/workflows/publish-image.yaml b/.github/workflows/publish-image.yaml new file mode 100644 index 0000000..49c4cbf --- /dev/null +++ b/.github/workflows/publish-image.yaml @@ -0,0 +1,24 @@ +name: Publish Image + +on: + workflow_dispatch: + workflow_call: + +jobs: + publish: + runs-on: ubuntu-latest + + strategy: + matrix: + platform: + - linux/amd64 + - linux/arm64 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - run: make publish-image diff --git a/.github/workflows/publish-package.yaml b/.github/workflows/publish-package.yaml new file mode 100644 index 0000000..c7cd1ea --- /dev/null +++ b/.github/workflows/publish-package.yaml @@ -0,0 +1,18 @@ +name: Publish Package + +on: + workflow_dispatch: + workflow_call: + +jobs: + publish: + runs-on: ubuntu-latest + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + + steps: + - uses: actions/checkout@v4 + - uses: asdf-vm/actions/install@v3 + - run: make publish-package diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 086682e..09ca6b5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,14 +6,8 @@ on: - 'v*' jobs: - build: - runs-on: ubuntu-latest + publish-package: + uses: ./.github/workflows/publish-package.yaml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - - steps: - - uses: actions/checkout@v4 - - uses: asdf-vm/actions/install@v3 - - run: make publish + publish-image: + uses: ./.github/workflows/publish-image.yaml \ No newline at end of file diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index 0f7c796..1c289e1 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: - build: + version: runs-on: ubuntu-latest env: diff --git a/Makefile b/Makefile index 89bd295..1fdda48 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ bump-patch: gh-bump: gh workflow run version.yaml -publish: build +publish-package: build rm -rdf dist ifdef DRY_RUN $(VENV) python -m twine upload --repository testpypi dist/* @@ -59,6 +59,9 @@ else $(VENV) python -m twine upload dist/* endif +publish-image: build-image + docker compose push + transcribe: install $(VENV) python transcribe_me/main.py diff --git a/compose.yaml b/compose.yaml index ba2d351..2d06303 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,7 @@ version: '3' services: app: + image: ghcr.io/echohello-dev/transcribe-me:latest build: . volumes: - ./input:/app/input