Merge pull request #4 from enzodjabali/3-implementing-an-auto-reply-a… #1
Workflow file for this run
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: Build and Publish to GitHub Packages on Tag | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Matches any tag; adjust for specific patterns like 'v*' | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| # Step 1: Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Step 2: Log in to GitHub Packages container registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 3: Build and tag the Docker image with version tag and 'latest' | |
| - name: Build and tag Docker image | |
| run: | | |
| TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag | |
| IMAGE=ghcr.io/enzodjabali/iosmb-router | |
| docker build --build-arg VERSION=$TAG -t $IMAGE:$TAG . | |
| docker tag $IMAGE:$TAG $IMAGE:latest | |
| # Step 4: Push the Docker image with version tag | |
| - name: Push Docker image with version tag | |
| run: | | |
| TAG=$(echo ${GITHUB_REF#refs/tags/}) # Extract the tag | |
| IMAGE=ghcr.io/enzodjabali/iosmb-router | |
| docker push $IMAGE:$TAG | |
| # Step 5: Push the Docker image with 'latest' tag | |
| - name: Push Docker image with 'latest' tag | |
| run: | | |
| IMAGE=ghcr.io/enzodjabali/iosmb-router | |
| docker push $IMAGE:latest |