Skip to content

Commit

Permalink
Avoid publishing Docker images in favour of external images
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus21337 committed Oct 9, 2024
1 parent c463071 commit b7d227c
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,57 +28,3 @@ jobs:
dry: true
only_changed: true

publish:
name: Publish to Docker Hub
needs: check
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && endsWith(github.repository, '-boilerplate')

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Extract project metadata
env:
AUTHOR: ${{ vars.DOCKER_HUB_USERNAME }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
run: |
SEMVER=$(jq ".version" package.json | tr -d '"')
declare -a versions=()
declare -a split_by_slash=()
IFS='.' read -ra versions <<< "$SEMVER"
IFS="/" read -ra split_by_slash <<< "$GITHUB_REPOSITORY"
echo "SEMVER=$SEMVER" >> "$GITHUB_ENV"
echo "MAJOR=${versions[0]}" >> "$GITHUB_ENV"
echo "MINOR=${versions[1]}" >> "$GITHUB_ENV"
echo "AUTHOR=${AUTHOR:-${split_by_slash[0]}}" >> "$GITHUB_ENV"
echo "DEVELOPMENT=$GITHUB_REPOSITORY:development" >> "$GITHUB_ENV"
echo "PRODUCTION=$GITHUB_REPOSITORY:production" >> "$GITHUB_ENV"
- uses: docker/setup-buildx-action@v3
name: Setup Docker Buildx

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.AUTHOR }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Publish development tags
uses: docker/build-push-action@v6
with:
context: .devcontainer/
push: true
tags: ${{ env.DEVELOPMENT }},${{ env.DEVELOPMENT }}-${{ env.MAJOR }},${{ env.DEVELOPMENT }}-${{ env.MAJOR }}.${{ env.MINOR }},${{ env.DEVELOPMENT }}-${{ env.SEMVER }}

- name: Publish production tags
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.PRODUCTION }},${{ env.PRODUCTION }}-${{ env.MAJOR }},${{ env.PRODUCTION }}-${{ env.MAJOR }}.${{ env.MINOR }},${{ env.PRODUCTION }}-${{ env.SEMVER }}

0 comments on commit b7d227c

Please sign in to comment.