added github env and output #3
This file contains hidden or 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
name: twelth_workflow | |
on: | |
push: | |
jobs: | |
job_A: | |
name: Job A | |
runs-on: ubuntu-latest | |
outputs: | |
FILE_CONTENT: ${{ steps.check-replaced-file.outputs.CONTENT }} | |
steps: | |
- name: Set dynamic environment variables | |
id: set-env | |
run: | | |
echo "NAME=$(hostname)" >> $GITHUB_ENV | |
- name: Check environment variables | |
id: check-env | |
run: | | |
echo "Environment variables:" | |
echo "NAME: ${{ env.NAME }}" | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Replace token in file | |
id: replace-token | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
tokenPrefix: '__' | |
tokenSuffix: '__' | |
files: '["files/*.txt"]' | |
env: | |
NAME: ${{ env.NAME }} | |
LOCATION: 'Delhi' | |
- name: Check replaced file | |
id: check-replaced-file | |
run: | | |
echo "Replaced file content:" | |
cat files/*.txt | |
echo "CONTENT=$(cat files/*.txt)" >> $GITHUB_OUTPUT | |
job_B: | |
name: Job B | |
runs-on: ubuntu-latest | |
needs: job_A | |
steps: | |
- name: Check replaced file content | |
id: check-file-content | |
run: | | |
echo "${{ needs.job_A.outputs.FILE_CONTENT }}" |