Skip to content

Commit

Permalink
MiR Docker build actions (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-Tomas authored Nov 28, 2024
1 parent e24c0cf commit 0ae9cec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
37 changes: 36 additions & 1 deletion .github/workflows/mir_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
cd mir_connector
pytest
publish:
publish-pypi:
if: contains(github.event.head_commit.message, 'Bump version')
needs: [test, lint]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -90,3 +90,38 @@ jobs:
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: mir_connector/dist/

publish-docker:
if: ${{ contains(github.event.head_commit.message, 'Bump version') }}
needs: [test, lint]
runs-on: ubuntu-latest
strategy:
fail-fast: true
environment: release
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set version environment variable
run: |
CONNECTOR_VERSION=$(grep -oP '(?<=current_version = ")[^"]*' mir_connector/.bumpversion.toml)
echo "CONNECTOR_VERSION=$CONNECTOR_VERSION" >> $GITHUB_ENV
echo "CONNECTOR_VERSION is '$CONNECTOR_VERSION'"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Google Artifact Registry
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:mir_connector"
file: ./docker/Dockerfile
push: true
tags: us-central1-docker.pkg.dev/inorbit-integrations/connectors/mir_connector:${{ env.CONNECTOR_VERSION }}
4 changes: 3 additions & 1 deletion mir_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bump-my-version bump minor --dry-run --verbose

### Build and publish the package

New releases are built and published to PyPi automatically by GitHub Actions when a new version bump commit is pushed.
New releases are built and published to PyPi and the Docker repository automatically by GitHub Actions when a new version bump commit is pushed.

> _Note:_ The message of the last commit must contain "Bump version" for the publish job to run. e.g. "Bump version: 1.0.0 -> 1.0.1"
Expand All @@ -162,4 +162,6 @@ twine check dist/* # Run checks
twine upload --repository testpypi dist/* # Upload to test PyPI. $HOME/.pypirc should exist and contain the api tokens. See https://pypi.org/help/#apitoken
```

To manually push the Docker image run `./docker/build.sh --push`

![Powered by InOrbit](../assets/inorbit_github_footer.png)

0 comments on commit 0ae9cec

Please sign in to comment.