Skip to content

Exploring variables and secrets #8

Exploring variables and secrets

Exploring variables and secrets #8

name: Exploring variables and secrets
on: workflow_dispatch
# schedule:
# - cron: "*/1 * * * *"
env:
IMAGENAME: NGINX
CONTAINER_REGISTRY: docker.io
jobs:
Docker:
runs-on: ubuntu-latest
steps:
- name: Docker build
run: echo docker build -t docker.io/${{ vars.DOCKERUSERNAME }}/$IMAGENAME:latest
- name: Docker login
run: echo docker login --username=${{ vars.DOCKERUSERNAME }} --password=${{ secrets.PASS }}
- name: Docker publish
run: echo docker push $CONTAINER_REGISTRY/${{ vars.DOCKERUSERNAME }}/$IMAGENAME:latest
Deploy:
if: github.ref == "refs/heads/main"

Check failure on line 22 in .github/workflows/variable-secrets.yaml

View workflow run for this annotation

GitHub Actions / Exploring variables and secrets

Invalid workflow file

The workflow is not valid. .github/workflows/variable-secrets.yaml (Line: 22, Col: 9): Unexpected symbol: '"refs/heads/main"'. Located at position 15 within expression: github.ref == "refs/heads/main"
needs: Docker
concurrency:
group: production-deployment
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Docker run
timeout-minutes: 1
run: |
echo docker run -d -p 8080:80 $CONTAINER_REGISTRY/${{ vars.DOCKERUSERNAME }}/$IMAGENAME:latest
sleep 6000s