Skip to content

Commit

Permalink
Auto-detect author from GITHUB_REPOSITORY over repo variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus21337 committed Oct 8, 2024
1 parent 0244622 commit a12d415
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@ jobs:

- 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"
Expand All @@ -62,7 +66,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
username: ${{ env.AUTHOR }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Publish development tags
Expand Down

0 comments on commit a12d415

Please sign in to comment.