As title, how to pass variable across different jobs?
I have tried this one, but no luck with gitea action.
As title, how to pass variable across different jobs?
I have tried this one, but no luck with gitea action.
What’s your configuration or workflow file?
name: Build arm64 image
run-name: ${{ gitea.actor }} build invidious.
on:
workflow_dispatch:
schedule:
- cron: "1 1 1 * *" # Every on first day everymonth
push:
branches:
- main
paths-ignore:
- LICENCE
jobs:
build-arm64:
runs-on: [arm64]
container:
image: ${{ secrets.DOCKER_REPO }}/actbuildx:latest
steps:
- name: Set RELEASE_DATE
id: build-arm64
run: |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
echo "RELEASE_DATE2=$(date --rfc-3339=date)" >> ${GITHUB_OUTPUT}
build-multi-architecture:
needs: build-arm64
runs-on: ubuntu-latest
container:
image: ${{ secrets.DOCKER_REPO }}/actbuildx:latest
steps:
- name: Set RELEASE_DATE
run: |
set -x
echo "${{ steps.build-arm64.env.RELEASE_DATE }}"
echo "${{ needs.steps.build-arm64.env.RELEASE_DATE }}"
echo "${{ steps.build-arm64.outputs.RELEASE_DATE2 }}"
echo "${{ needs.steps.build-arm64.outputs.RELEASE_DATE2 }}"
Would you please show us correct example? or any document link?
Thank you.
Did you mean read the output variables of one step from another step? Or you mean global variables?
Yes, I want export variable in first job, then read it in second job.
btw, can I export variable as a global variables? (then even read it in other workflow?)
Ok, I found the solution
jobs:
build-arm64:
runs-on: [arm64]
container:
image: ${{ secrets.DOCKER_REPO }}/actbuildx:latest
outputs:
release_date: ${{ steps.build-arm64.outputs.RELEASE_DATE }}
steps:
- name: Set RELEASE_DATE
id: build-arm64
run: |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_OUTPUT}
- name: Get RELEASE_DATE
run: |
set -x
echo "${{ steps.build-arm64.outputs.RELEASE_DATE }}"
build-multi-architecture:
needs: build-arm64
runs-on: ubuntu-latest
container:
image: ${{ secrets.DOCKER_REPO }}/actbuildx:latest
steps:
- name: Get RELEASE_DATE
run: |
set -x
echo "$RELEASE_DATE"
env:
RELEASE_DATE: ${{ needs.build-arm64.outputs.release_date }}