Pass action-defined vars via env step property

This commit is contained in:
Maciej Pędzich 2024-04-06 12:02:13 +02:00
parent de50d82e15
commit 9b832ea452
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
2 changed files with 6 additions and 6 deletions

View File

@ -11,4 +11,9 @@ jobs:
- name: Build Docker image
run: docker build -t ${{ vars.IMAGE_TAG }} .
- name: Rerun website's Docker container
run: chmod +x ./rerun-container.sh && (./rerun-container.sh ${{ vars.CONTAINER_NAME }} ${{ vars.PORT_PAIR }} ${{ vars.NETWORK_NAME }} ${{ vars.IMAGE_TAG }})
env:
CONTAINER_NAME: ${{ vars.CONATINER_NAME }}
NETWORK_NAME: ${{ vars.NETWORK_NAME }}
PORT_PAIR: ${{ vars.PORT_PAIR }}
IMAGE_TAG: ${{ vars.IMAGE_TAG }}
run: chmod +x ./rerun-container.sh && ./rerun-container.sh

View File

@ -1,10 +1,5 @@
#!/usr/bin/sh
CONTAINER_NAME = $1;
PORT_PAIR = $2;
NETWORK_NAME = $3;
IMAGE_TAG = $4;
docker stop $CONTAINER_NAME && \
docker container rm $(docker ps -aqf "name=$CONTAINER_NAME") && \
docker run -d -p $PORT_PAIR --netwok $NETWORK_NAME --name $CONTAINER_NAME $IMAGE_TAG