Where exatly is the syntax error? (You have an error in your yaml syntax)

Hi,

I’m trying to use the following yml, but github complains about it (“You have an error in your yaml syntax on line 54”). I can’t see anything suspicious in line 54. Any ideas?

name: build

on:
  push:
    branches: [ master ]
    tags:
      - 'v*' 
  pull_request:
    branches: [ master ]

jobs:
  build:
    name: Build Project
    runs-on: ubuntu-latest
    strategy:
      matrix:
        raspberrypi: ['raspberrypi2', 'raspberrypi3]
    steps:
    - name: Checkout project
      uses: actions/checkout@v2
      with:
        submodules: true
        fetch-depth: 0 # for git describe
    - name: Fetch tags
      run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
    - name: Print version
      run: git describe
    - name: Print tags
      run: git tag
    - name: Build image
      run: |
        cd software
        make BR2_EXTERNAL=$PWD/br-external -C buildroot ${{ matrix.raspberrypi }}-heating-control_defconfig
        make -C buildroot
    - name: Build legal-info
      run: |
        cd software
        make -C buildroot legal-info
        tar -cvf legal-info.tar buildroot/output/legal-info/
    - name: Upload artifact sd card image
      uses: actions/upload-artifact@v2
      with:
        name: image-${{ matrix.raspberrypi }}
        path: software/buildroot/output/images/sdcard.img
    - name: Upload artifact legal-info
      uses: actions/upload-artifact@v2
      with:
        name: legal-info-${{ matrix.raspberrypi }}
        path: software/legal-info.tar
  
  create_release_job:
    name: Create Release
    needs: build
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        draft: true
        prerelease: false
  
  upload_assests:
    name: Upload Release assets
    needs: create_release_job
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    strategy:
      matrix:
        raspberrypi: ['raspberrypi2', 'raspberrypi3]
    steps:
    - name: Download sd card image
      uses: actions/download-artifact@v2
      with:
        name: image-${{ matrix.raspberrypi }}
    - name: Download legal-info
      uses: actions/download-artifact@v2
      with:
        name: legal-info-${{ matrix.raspberrypi }}
    - name: Upload release assets
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ create_release_job.steps.create_release.outputs.upload_url }}
        asset_path: ./sdcard.img
        asset_name: SIP-Heating-Gateway-${{ steps.get_version.outputs.VERSION }}-sdcard-${{ matrix.raspberrypi }}.img
        asset_content_type: application
    - name: Upload release asset legal-info
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ create_release_job.steps.create_release.outputs.upload_url }}
        asset_path: ./legal-info.tar
        asset_name: SIP-Heating-Gateway-${{ steps.get_version.outputs.VERSION }}-legal-info-${{ matrix.raspberrypi }}.tar
        asset_content_type: application

You are missing closing ' twice:

raspberrypi: ['raspberrypi2', 'raspberrypi3]

Should be:

raspberrypi: ['raspberrypi2', 'raspberrypi3']

Thx! This explains the strange syntax highlighting above.

Now I just need to figure out, how I can access the upload_url from a different job.

Have a look here:

Probably like this:

  create_release_job:
    name: Create Release
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
...
  upload_assests:
    name: Upload Release assets
    needs: create_release_job
...
    - name: Upload release assets
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ needs.create_release_job.outputs.upload_url }}

@Simran-B thanks again! jobs.<jobs_id>.outputs is exactly what I was looking for