mirror of
https://github.com/nushell/nushell
synced 2024-12-25 20:43:09 +00:00
Move env declaration to jobs.docker
This commit is contained in:
parent
3e14de158b
commit
7cf3c6eb95
2 changed files with 16 additions and 20 deletions
34
.github/workflows/docker-publish.yml
vendored
34
.github/workflows/docker-publish.yml
vendored
|
@ -35,6 +35,10 @@ jobs:
|
|||
name: Build and publish docker images
|
||||
needs: compile
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_REGISTRY: quay.io/nushell
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY }}
|
||||
DOCKER_USER: nushell+action # TBD
|
||||
strategy:
|
||||
matrix:
|
||||
tag:
|
||||
|
@ -63,19 +67,16 @@ jobs:
|
|||
with: { name: '${{ matrix.arch }}', path: target/release }
|
||||
- name: Build and publish exact version
|
||||
run: |-
|
||||
REGISTRY=${REGISTRY,,}; export TAG=${GITHUB_REF##*/}-${{ matrix.tag }}
|
||||
export DOCKER_TAG=${GITHUB_REF##*/}-${{ matrix.tag }}
|
||||
export NU_BINS=target/release/$( [ ${{ matrix.plugin }} = true ] && echo nu* || echo nu )
|
||||
export PATCH=$([ ${{ matrix.use-patch }} = true ] && echo .${{ matrix.tag }} || echo '')
|
||||
chmod +x $NU_BINS
|
||||
|
||||
echo ${{ secrets.DOCKER_REGISTRY }} | docker login ${REGISTRY%/*} -u ${USER,,} --password-stdin
|
||||
echo ${DOCKER_PASSWORD} | docker login ${DOCKER_REGISTRY} -u ${DOCKER_USER} --password-stdin
|
||||
docker-compose --file docker/docker-compose.package.yml build
|
||||
docker-compose --file docker/docker-compose.package.yml push # exact version
|
||||
env:
|
||||
BASE_IMAGE: ${{ matrix.base-image }}
|
||||
# REGISTRY: docker.pkg.github.com/${{ github.repository }} #TODO: waiting support for GITHUB_TOKEN for docker.pkg.github.com
|
||||
USER: ${{ github.actor }}+action
|
||||
REGISTRY: quay.io/${{ github.actor }}
|
||||
|
||||
#region semantics tagging
|
||||
- name: Retag and push with suffixed version
|
||||
|
@ -90,16 +91,14 @@ jobs:
|
|||
tags=( ${latest_version} ${latest_feature} ${latest_patch} ${exact_version} )
|
||||
|
||||
for tag in ${tags[@]}; do
|
||||
docker tag ${REGISTRY,,}/nu:${VERSION}-${{ matrix.tag }} ${REGISTRY,,}/nu:${tag}
|
||||
docker push ${REGISTRY,,}/nu:${tag}
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${tag}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${tag}
|
||||
done
|
||||
|
||||
# latest version
|
||||
docker tag ${REGISTRY,,}/nu:${VERSION}-${{ matrix.tag }} ${REGISTRY,,}/nu:${{ matrix.tag }}
|
||||
docker push ${REGISTRY,,}/nu:${{ matrix.tag }}
|
||||
env:
|
||||
# REGISTRY: 'docker.pkg.github.com/${{ github.repository }}' #TODO: waiting support for GITHUB_TOKEN for docker.pkg.github.com
|
||||
REGISTRY: quay.io/${{ github.actor }}
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${{ matrix.tag }}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${{ matrix.tag }}
|
||||
|
||||
- name: Retag and push debian as latest
|
||||
if: matrix.tag == 'debian'
|
||||
run: |-
|
||||
|
@ -109,14 +108,11 @@ jobs:
|
|||
tags=( ${VERSION%%.*} ${VERSION%.*} ${VERSION} )
|
||||
|
||||
for tag in ${tags[@]}; do
|
||||
docker tag ${REGISTRY,,}/nu:${VERSION}-${{ matrix.tag }} ${REGISTRY,,}/nu:${tag}
|
||||
docker push ${REGISTRY,,}/nu:${tag}
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${tag}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${tag}
|
||||
done
|
||||
|
||||
# latest version
|
||||
docker tag ${REGISTRY,,}/nu:${{ matrix.tag }} ${REGISTRY,,}/nu:latest
|
||||
docker push ${REGISTRY,,}/nu:latest
|
||||
env:
|
||||
# REGISTRY: 'docker.pkg.github.com/${{ github.repository }}' #TODO: waiting support for GITHUB_TOKEN for docker.pkg.github.com
|
||||
REGISTRY: quay.io/${{ github.actor }}
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:latest
|
||||
docker push ${DOCKER_REGISTRY}/nu:latest
|
||||
#endregion semantics tagging
|
||||
|
|
|
@ -2,7 +2,7 @@ version: '3'
|
|||
|
||||
services:
|
||||
nushell:
|
||||
image: ${REGISTRY}/nu:${TAG}
|
||||
image: ${DOCKER_REGISTRY}/nu:${DOCKER_TAG}
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Package${PATCH}.Dockerfile
|
||||
|
|
Loading…
Reference in a new issue