Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiR Docker build actions #30

Merged
merged 13 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading