Skip to content

Commit

Permalink
fix: Fix pipelines to build versioned images
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpeople committed Sep 30, 2021
1 parent 52758f7 commit d04514a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,55 @@ jobs:
run: |
# echo ::set-output name=build-arg1::"buildarg1"
# echo ::set-output name=build-arg2::"buildarg2"
-
name: Bump version and push tag if needed
id: tag_version
if: github.event_name == 'push'
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
-
name: Create a GitHub release if new version
uses: actions/create-release@v1
if: ${{ steps.tag_version.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
-
name: Prepare
id: prep
run: |
IMAGENAME=$(echo ${{ github.repository }} | sed 's/${{ github.repository_owner }}\/docker-//g')
IMAGEPREFIX="ghcr.io/${{ github.repository_owner }}"
IMAGE="${IMAGEPREFIX}/${IMAGENAME}"
TAGS="${IMAGE}:latest"
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=weekly
elif [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=devel
fi
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
if [[ "${{ steps.tag_version.outputs.new_tag }}" != "" ]]; then
VERSION=${{ steps.tag_version.outputs.new_tag }}
fi
TAGS="${IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${IMAGE}:${MINOR},${IMAGE}:${MAJOR},${IMAGE}:latest"
# elif [ "${{ github.event_name }}" = "push" ]; then
# TAGS="$TAGS,${IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=imagename::${IMAGENAME}
echo ::set-output name=version::${VERSION}
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ This image allows you to have JDownloader 2 easily installed and controlled via
```amd64```, ```armv7```, ```i386``` and ```arm64```

## Image tags
- ```latest``` gets automatically built on every push to master and also via a weekly cron job
- ```latest``` always refers to the latest tagged release.
- There are tags for major, minor and patchreleases (eg. ```1.0.0```, ```1.0```, ```1``` ) note that this is the version of the image, not from jdownloader
- ```weekly``` gets automatically built a weekly cron job
- ```devel``` gets automatically built on every push and represents the latest version of the repo

## Usage
Installation
Expand Down

0 comments on commit d04514a

Please sign in to comment.