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

ci: publish container with all version tags TDE-527 #299

Merged
merged 11 commits into from
Jan 19, 2023
6 changes: 4 additions & 2 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
docker build . --tag topo-imagery --label "github_run_id=${GITHUB_RUN_ID}"

- name: Log in to registry
if: ${{(github.ref == 'refs/heads/master') && !(startsWith(github.event.head_commit.message, 'release:'))}}
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Publish Containers
if: ${{(github.ref == 'refs/heads/master') && !(startsWith(github.event.head_commit.message, 'release:'))}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid a tag being created at this stage when a release is published.

run: |
GIT_VERSION=$(git describe --tags --always --match 'v*')
docker tag topo-imagery ghcr.io/linz/topo-imagery:${GIT_VERSION}
docker push ghcr.io/linz/topo-imagery:${GIT_VERSION}
docker tag topo-imagery ghcr.io/linz/topo-imagery:latest
docker tag topo-imagery ghcr.io/linz/topo-imagery:${GIT_VERSION}
docker push ghcr.io/linz/topo-imagery:latest
docker push ghcr.io/linz/topo-imagery:${GIT_VERSION}
27 changes: 26 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,35 @@ jobs:
with:
release-type: python
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-title-pattern: "release: ${version}"

publish-release:
paulfouquet marked this conversation as resolved.
Show resolved Hide resolved
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: ./.github/workflows/containers
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build containers
run: |
docker build . --tag topo-imagery --label "github_run_id=${GITHUB_RUN_ID}"

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Publish Containers
run: |
GIT_VERSION=$(git describe --tags --always --match 'v*')
GIT_VERSION_MAJOR=$(echo $GIT_VERSION | cut -d. -f1)
GIT_VERSION_MAJOR_MINOR=$(echo $GIT_VERSION | cut -d. -f1,2)
docker tag topo-imagery ghcr.io/linz/topo-imagery:latest
docker tag topo-imagery ghcr.io/linz/topo-imagery:${GIT_VERSION_MAJOR_MINOR}
docker tag topo-imagery ghcr.io/linz/topo-imagery:${GIT_VERSION_MAJOR}
docker tag topo-imagery ghcr.io/linz/topo-imagery:${GIT_VERSION}
docker push ghcr.io/linz/topo-imagery:latest
docker push ghcr.io/linz/topo-imagery:${GIT_VERSION_MAJOR_MINOR}
docker push ghcr.io/linz/topo-imagery:${GIT_VERSION_MAJOR}
docker push ghcr.io/linz/topo-imagery:${GIT_VERSION}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid prettier to complain about * VS - in the changelog generated by release-please