.github/workflows/test.yml #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
# Setting an environment variable with the value of a configuration variable | |
env_var: ${{ vars.MY_VAR }} | |
bool_var: ${{ vars.MY_BOOL}} | |
SOURCE_FILES: "data/spells/*.json data/class/*.json data/*.json data/book/*.json data/adventure/*.json data/bestiary/*.json" | |
repo: ${{github.repository}} | |
on: | |
workflow_dispatch: | |
inputs: | |
source: | |
description: "Source files" | |
required: False | |
default: ${SOURCE_FILES} | |
jobs: | |
display-variables: | |
name: "display vars1" | |
environment: test | |
# You can use configuration variables with the `vars` context for dynamic jobs | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Use variables | |
if: vars.MY_BOOL | |
run: | | |
echo "bool variable : $MY_BOOL" | |
echo "var variable : $MY_VAR" | |
echo "env variable shell : $env_var" | |
echo "bool from shell environment : $bool_var" | |
echo "source files var $SOURCE_FILES" | |
echo "input: ${{inputs.source}}" | |
echo "else: ${{inputs.source != '' && inputs.source || env.SOURCE_FILES}}" | |
echo "${{github.repository}}" | |
echo "$repo" | |
env: | |
MY_BOOL: ${{vars.MY_BOOL}} | |
- name: Use variables2 | |
if: vars.MY_TEST | |
run: | | |
echo "$MY_TEST" | |
echo "${{vars.MY_TEST}}" | |
echo "$COUCOU" | |
env: | |
COUCOU: ${{vars.MY_TEST}} | |
example_matrix: | |
runs-on: ubuntu-latest | |
needs: display-variables | |
strategy: | |
matrix: | |
lang: ["fr"] | |
convert_to_metric: [true] | |
include: | |
- lang: fr | |
convert_to_metric: true | |
- lang: de | |
convert_to_metric: true | |
- lang: en | |
convert_to_metric: false | |
steps: | |
- name: "print matrix" | |
run: | | |
echo "var variable : ${{ matrix.lang }}" | |
echo "bool variable : ${{ matrix.convert_to_metric }}" | |
echo "env variable shell : $env_var" | |
echo "bool from shell environment : $bool_var" | |
echo "test action var : $MY_TEST" | |
echo "test 2: $vars.MY_TEST" | |
echo -n "echo translate" >> command.sh | |
- name: "add param" | |
if: matrix.convert_to_metric | |
run: | | |
echo -n "YOUUUU" >> command.sh | |
- name: "print command" | |
run: | | |
ls | |
cat command.sh | |
- name: Execute command | |
run: bash command.sh |