mirror of
https://staging.allspice.dev/AllSpice-Demos/Actions-demo.git
synced 2025-09-08 15:27:38 +00:00
36 lines
1.6 KiB
YAML
36 lines
1.6 KiB
YAML
# Secrets, Variables, and Keys demo
|
|
# This workflow demonstrates how to use secrets, variables, and keys in the workflow
|
|
# AllSpice Actions documentation: https://learn.allspice.io/docs/actions-cicd
|
|
name: Secrets-Variables-Keys-Demo
|
|
on:
|
|
push:
|
|
issues:
|
|
types: [opened, closed, reopened]
|
|
|
|
jobs:
|
|
py-allspice test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Check out repository code
|
|
- name: "[📚->🖥️] Check out repository code"
|
|
uses: actions/checkout@v3
|
|
|
|
# Print repository action variable VARIABLE_NAME and value
|
|
- name: Print repository Action variable 🔎
|
|
run: |
|
|
echo "Repository variable VARIABLE_NAME = ${{ vars.VARIABLE_NAME }}"
|
|
echo "Repository variables are stored in ${{ allspice.server_url }}/${{ allspice.repository }}/settings/actions/variables"
|
|
|
|
- name: Use Secret 🔎
|
|
# Store the secret in an environment variable YOUR_SECRET
|
|
env:
|
|
ENV_SECRET: ${{ secrets.YOUR_SECRET }}
|
|
|
|
# Demonstrate how to use secrets in the workflow
|
|
run: |
|
|
echo "Secrets are stored in ${{ allspice.server_url }}/${{ allspice.repository }}"/settings/actions/secrets
|
|
echo "Secrets are only available to the repository admins and the workflow"
|
|
echo "Store API Tokens in secrets and use them in the workflow without exposing them"
|
|
echo "Secrets are not printed to the terminal for security reasons and will be replaced with ***"
|
|
echo "Using secret from /settings/actions/secrets YOUR_SECRET=${{ secrets.YOUR_SECRET }}"
|
|
echo "Using secret from stored envrironmental variable ENV_SECRET=$YOUR_SECRET" |