|
11 | 11 | test: |
12 | 12 | # When running with act (https://github.com/nektos/act), these lines need to be appended with the ACT variable |
13 | 13 | # to force each job to run |
14 | | - if: github.repository == 'adobe/buildrunner' #|| ${{ env.ACT }} |
| 14 | + if: github.repository == 'adobe/buildrunner' && (github.ref != 'refs/heads/main' || github.event.pull_request.merged == true) #|| ${{ env.ACT }} |
15 | 15 | runs-on: ubuntu-latest |
16 | 16 | strategy: |
17 | 17 | fail-fast: false |
@@ -49,27 +49,35 @@ jobs: |
49 | 49 | check_name: "Test Results ${{ matrix.python-version }}" |
50 | 50 | github_retries: 10 |
51 | 51 | secondary_rate_limit_wait_seconds: 60.0 |
52 | | - tag-commit: |
53 | | - if: github.repository == 'adobe/buildrunner' && github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 52 | + get-version: |
| 53 | + if: github.repository == 'adobe/buildrunner' |
54 | 54 | runs-on: ubuntu-latest |
55 | 55 | needs: test |
| 56 | + outputs: |
| 57 | + current-version: ${{ steps.version-number.outputs.CURRENT_VERSION }} |
56 | 58 | steps: |
57 | 59 | - uses: actions/checkout@v2 |
58 | 60 | with: |
59 | 61 | # Fetch all history instead of the latest commit |
60 | 62 | fetch-depth: 0 |
61 | | - - name: Install dependencies |
62 | | - run: | |
63 | | - python -m pip install --upgrade pip |
64 | | - pip install -r requirements.txt |
65 | 63 | - name: Write version file |
66 | 64 | run: python scripts/write-version.py |
67 | | - - name: Get and set version in env |
68 | | - run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_ENV |
| 65 | + - name: Get current version |
| 66 | + id: version-number |
| 67 | + run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_OUTPUT |
69 | 68 | - name: Print current version |
70 | | - run: echo CURRENT_VERSION ${{ env.CURRENT_VERSION }} |
| 69 | + run: echo CURRENT_VERSION ${{ steps.version-number.outputs.CURRENT_VERSION }} |
| 70 | + tag-commit: |
| 71 | + if: github.repository == 'adobe/buildrunner' && github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: [test, get-version] |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + with: |
| 77 | + # Fetch all history instead of the latest commit |
| 78 | + fetch-depth: 0 |
71 | 79 | - name: Tag commit |
72 | | - run: git tag ${{ env.CURRENT_VERSION }} && git push --tags |
| 80 | + run: git tag ${{ needs.get-version.outputs.current-version }} && git push --tags |
73 | 81 | publish-pypi: |
74 | 82 | if: github.repository == 'adobe/buildrunner' |
75 | 83 | runs-on: ubuntu-latest |
@@ -104,26 +112,20 @@ jobs: |
104 | 112 | publish-docker: |
105 | 113 | if: github.repository == 'adobe/buildrunner' |
106 | 114 | runs-on: ubuntu-latest |
107 | | - needs: test |
| 115 | + needs: [test, get-version] |
108 | 116 | steps: |
109 | 117 | - uses: actions/checkout@v2 |
110 | 118 | with: |
111 | 119 | # Fetch all history instead of the latest commit |
112 | 120 | fetch-depth: 0 |
113 | | - - name: Write version file |
114 | | - run: python scripts/write-version.py |
115 | | - - name: Get and set version in env |
116 | | - run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_ENV |
117 | | - - name: Print current version |
118 | | - run: echo CURRENT_VERSION ${{ env.CURRENT_VERSION }} |
119 | 121 | - name: Docker Tags |
120 | 122 | id: docker_tags |
121 | 123 | uses: docker/metadata-action@v3 |
122 | 124 | with: |
123 | 125 | images: ghcr.io/adobe/buildrunner |
124 | 126 | tags: | |
125 | 127 | latest |
126 | | - ${{ env.CURRENT_VERSION }} |
| 128 | + ${{ needs.get-version.outputs.current-version }} |
127 | 129 | - name: Set up QEMU |
128 | 130 | uses: docker/setup-qemu-action@v1 |
129 | 131 | with: |
|
0 commit comments