diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3e55f23e..f2a454f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,7 @@ jobs: test: # When running with act (https://github.com/nektos/act), these lines need to be appended with the ACT variable # to force each job to run - if: github.repository == 'adobe/buildrunner' #|| ${{ env.ACT }} + if: github.repository == 'adobe/buildrunner' && (github.ref != 'refs/heads/main' || (github.ref == 'refs/heads/main' && github.event.pull_request.merged != true)) #|| ${{ env.ACT }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -49,10 +49,12 @@ jobs: check_name: "Test Results ${{ matrix.python-version }}" github_retries: 10 secondary_rate_limit_wait_seconds: 60.0 - tag-commit: - if: github.repository == 'adobe/buildrunner' && github.event_name == 'push' && github.ref == 'refs/heads/main' + get-version: + if: github.repository == 'adobe/buildrunner' runs-on: ubuntu-latest needs: test + outputs: + current-version: ${{ steps.version-number.outputs.CURRENT_VERSION }} steps: - uses: actions/checkout@v2 with: @@ -64,12 +66,22 @@ jobs: pip install -r requirements.txt - name: Write version file run: python scripts/write-version.py - - name: Get and set version in env - run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_ENV + - name: Get current version + id: version-number + run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_OUTPUT - name: Print current version - run: echo CURRENT_VERSION ${{ env.CURRENT_VERSION }} + run: echo CURRENT_VERSION ${{ steps.version-number.outputs.CURRENT_VERSION }} + tag-commit: + if: github.repository == 'adobe/buildrunner' && github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [test, get-version] + steps: + - uses: actions/checkout@v2 + with: + # Fetch all history instead of the latest commit + fetch-depth: 0 - name: Tag commit - run: git tag ${{ env.CURRENT_VERSION }} && git push --tags + run: git tag ${{ needs.get-version.outputs.current-version }} && git push --tags publish-pypi: if: github.repository == 'adobe/buildrunner' runs-on: ubuntu-latest @@ -83,11 +95,14 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install wheel build - name: Remove version file # This is just in case something else created it, destroy it to get a fresh version run: rm -f buildrunner/version.py - - name: Install wheel - run: pip install wheel build - name: Write version file run: python scripts/write-version.py - name: Build @@ -104,18 +119,12 @@ jobs: publish-docker: if: github.repository == 'adobe/buildrunner' runs-on: ubuntu-latest - needs: test + needs: [test, get-version] steps: - uses: actions/checkout@v2 with: # Fetch all history instead of the latest commit fetch-depth: 0 - - name: Write version file - run: python scripts/write-version.py - - name: Get and set version in env - run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_ENV - - name: Print current version - run: echo CURRENT_VERSION ${{ env.CURRENT_VERSION }} - name: Docker Tags id: docker_tags uses: docker/metadata-action@v3 @@ -123,7 +132,7 @@ jobs: images: ghcr.io/adobe/buildrunner tags: | latest - ${{ env.CURRENT_VERSION }} + ${{ needs.get-version.outputs.current-version }} - name: Set up QEMU uses: docker/setup-qemu-action@v1 with: