diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index eba73bae2f8..3f0fdb23b13 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -7,26 +7,7 @@ on: jobs: load-env: - runs-on: ubuntu-latest - outputs: - base-image: ${{ steps.set-env.outputs.base-image }} - rosdistro: ${{ steps.set-env.outputs.rosdistro }} - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - - name: Set env - id: set-env - run: | - echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT - echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/load-env.yaml build-main-self-hosted: needs: load-env diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index ca1dafb4728..a57934080b0 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -7,26 +7,7 @@ on: jobs: load-env: - runs-on: ubuntu-latest - outputs: - base-image: ${{ steps.set-env.outputs.base-image }} - rosdistro: ${{ steps.set-env.outputs.rosdistro }} - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - - name: Set env - id: set-env - run: | - echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT - echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/load-env.yaml build-main: needs: load-env diff --git a/.github/workflows/load-env.yaml b/.github/workflows/load-env.yaml new file mode 100644 index 00000000000..1e86a6d0bba --- /dev/null +++ b/.github/workflows/load-env.yaml @@ -0,0 +1,32 @@ +name: load-env + +on: + workflow_call: + outputs: + base-image: + value: ${{ jobs.load-env.outputs.base-image }} + rosdistro: + value: ${{ jobs.load-env.outputs.rosdistro }} + +jobs: + load-env: + runs-on: ubuntu-latest + outputs: + base-image: ${{ steps.set-env.outputs.base-image }} + rosdistro: ${{ steps.set-env.outputs.rosdistro }} + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Load env + run: | + cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + if [ "$(uname -m)" = "aarch64" ]; then + cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + fi + + - name: Set env + id: set-env + run: | + echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT + echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/setup-docker.yaml b/.github/workflows/setup-docker.yaml index b55a2df8d38..9e3fee08f8c 100644 --- a/.github/workflows/setup-docker.yaml +++ b/.github/workflows/setup-docker.yaml @@ -4,9 +4,13 @@ on: pull_request: jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + setup-docker: + needs: load-env runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ${{ needs.load-env.outputs.base-image }} steps: - name: Check out repository uses: actions/checkout@v3 diff --git a/.github/workflows/setup-universe.yaml b/.github/workflows/setup-universe.yaml index 0081abd5d63..5735967e674 100644 --- a/.github/workflows/setup-universe.yaml +++ b/.github/workflows/setup-universe.yaml @@ -4,9 +4,13 @@ on: pull_request: jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + setup-universe: + needs: load-env runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ${{ needs.load-env.outputs.base-image }} steps: - name: Check out repository uses: actions/checkout@v3 diff --git a/.github/workflows/update-docker-manifest.yaml b/.github/workflows/update-docker-manifest.yaml index b92c9403b48..26cda041fc9 100644 --- a/.github/workflows/update-docker-manifest.yaml +++ b/.github/workflows/update-docker-manifest.yaml @@ -6,7 +6,11 @@ on: workflow_dispatch: jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + update-docker-manifest: + needs: load-env runs-on: ubuntu-latest steps: - name: Check out repository @@ -21,26 +25,26 @@ jobs: uses: ./.github/actions/create-main-distro-alias with: package-name: autoware-universe - rosdistro: galactic + rosdistro: ${{ needs.load-env.outputs.rosdistro }} tag-name: latest - name: Create alias from 'autoware-universe:{rosdistro}-latest-prebuilt' to 'autoware-universe:latest-prebuilt' uses: ./.github/actions/create-main-distro-alias with: package-name: autoware-universe - rosdistro: galactic + rosdistro: ${{ needs.load-env.outputs.rosdistro }} tag-name: latest-prebuilt - name: Create alias from 'autoware-universe:{rosdistro}-latest-cuda' to 'autoware-universe:latest-cuda' uses: ./.github/actions/create-main-distro-alias with: package-name: autoware-universe - rosdistro: galactic + rosdistro: ${{ needs.load-env.outputs.rosdistro }} tag-name: latest-cuda - name: Create alias from 'autoware-universe:{rosdistro}-latest-prebuilt-cuda' to 'autoware-universe:latest-prebuilt-cuda' uses: ./.github/actions/create-main-distro-alias with: package-name: autoware-universe - rosdistro: galactic + rosdistro: ${{ needs.load-env.outputs.rosdistro }} tag-name: latest-prebuilt-cuda diff --git a/.github/workflows/vcs-import.yaml b/.github/workflows/vcs-import.yaml index c77020ab184..829c1c81e29 100644 --- a/.github/workflows/vcs-import.yaml +++ b/.github/workflows/vcs-import.yaml @@ -5,9 +5,13 @@ on: workflow_dispatch: jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + vcs-import: + needs: load-env runs-on: ubuntu-latest - container: ros:galactic + container: ros:${{ needs.load-env.outputs.rosdistro }} steps: - name: Check out repository uses: actions/checkout@v3 @@ -20,7 +24,7 @@ jobs: - name: Register AutonomouStuff repository uses: autowarefoundation/autoware-github-actions/register-autonomoustuff-repository@v1 with: - rosdistro: galactic + rosdistro: ${{ needs.load-env.outputs.rosdistro }} - name: Set git config uses: autowarefoundation/autoware-github-actions/set-git-config@v1 @@ -40,4 +44,4 @@ jobs: run: | sudo apt-get -y update rosdep update - DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro galactic + DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro ${{ needs.load-env.outputs.rosdistro }}