Merge pull request #47 from contextforge-gateway-rs/user/luca/update-… #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| # tags: ["2.0.0"] | |
| env: | |
| IMAGE_NAME: contextforge-gateway-rs | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set version | |
| id: set_version | |
| run: | | |
| CF_VERSION=$(grep -m 1 '^version' Cargo.toml | sed 's/version\s*=\s*"\(.*\)"/\1/') | |
| echo "CF_VERSION=$CF_VERSION" >> $GITHUB_ENV | |
| - name: Show version | |
| run: echo $CF_VERSION | |
| - name: Build the Docker image | |
| run: docker build . --file docker/Dockerfile --tag $IMAGE_NAME:latest | |
| - name: Log in to registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Push image | |
| run: | | |
| IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
| docker tag $IMAGE_NAME:latest $IMAGE_ID:$CF_VERSION | |
| docker push $IMAGE_ID:$CF_VERSION | |