Skip to content

Commit

Permalink
add node print var in action.
Browse files Browse the repository at this point in the history
fix annotation error in Dockerfile
  • Loading branch information
slow-groovin committed Oct 17, 2024
1 parent 86a9a25 commit 2d2506f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set some variables
- name: print some variables
env:
VAR_IN_STEP1: "<var in step1>" # step level variable
run: |
cd environment
echo "VAR_IN_RUN=<var in run>" >> $GITHUB_ENV # set env variable in running
echo "[Print in step run]: ${{vars.VAR_IN_REPO}},${{secrets.SECRET_IN_REPO}},${{env.VAR_IN_JOB1}}, ${{env.VAR_IN_STEP1}}, ${{env.VAR_IN_RUN}} "
npm -v
node printVarsByActionRun.js
# console log result 👆👆:
# [Print in step run]: ,,<var in job1>, <var in step1>,
#
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions environment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN echo "[Print in Dockerfile Scope beginning]1.$VAR_REPO, 2.$SECRET_IN_REPO, 3
7.$SECRETS1, 8.$SECRET_ENV_1"


#desclare arg,on by this it can read args from `build-args:` setting in environment.yml, as well as `--build-arg` in docker build command
# declare arg,on by this it can read args from `build-args:` setting in environment.yml, as well as `--build-arg` in docker build command
ARG BUILD_ARG1

#set var in dockerfile scope
# set var in dockerfile scope
ENV VAR_IN_DOCKERFILE=<var in dockerfile>

RUN echo "[Print Dockerfile args/env]1.$BUILD_ARG1, 2.$VAR_IN_DOCKERFILE"
Expand Down

0 comments on commit 2d2506f

Please sign in to comment.