mirror of https://github.com/peter4431/rq.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
tags: [ '*' ]
|
|
workflow_dispatch:
|
|
|
|
|
|
permissions:
|
|
contents: read write # to fetch code (actions/checkout)
|
|
packages: write
|
|
|
|
jobs:
|
|
push:
|
|
if: github.repository == 'rq/rq'
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Push
|
|
run: |
|
|
# Parse Version
|
|
# "master" -> "master"
|
|
# "v1.2.3" -> "1.2.3", "1.2", "1", "latest"
|
|
|
|
VERSIONS=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
|
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && {
|
|
VERSIONS=$(echo $VERSIONS | sed -e 's/^v//')
|
|
i="$VERSIONS"
|
|
while [[ "$i" == *"."* ]]
|
|
do i="$(echo "$i" | sed 's/\(.*\)\..*/\1/g')"
|
|
VERSIONS="$VERSIONS $i"
|
|
done
|
|
VERSIONS="$VERSIONS latest"
|
|
}
|
|
|
|
echo Building with tags: $VERSIONS
|
|
|
|
# Login to registries
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
|
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u selwin --password-stdin
|
|
|
|
# Build image
|
|
docker build . --tag worker
|
|
|
|
# Tag and Push
|
|
for VERSION in $VERSIONS
|
|
do docker tag worker redisqueue/worker:$VERSION
|
|
docker push redisqueue/worker:$VERSION
|
|
docker tag worker docker.pkg.github.com/rq/rq/worker:$VERSION
|
|
docker push docker.pkg.github.com/rq/rq/worker:$VERSION
|
|
done
|