Skip to content

Commit b495b89

Browse files
author
Jacob Truman
committed
Improve build steps
1 parent 7bbadd6 commit b495b89

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

.github/workflows/build.yaml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
# When running with act (https://github.com/nektos/act), these lines need to be appended with the ACT variable
1313
# 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 }}
1515
runs-on: ubuntu-latest
1616
strategy:
1717
fail-fast: false
@@ -49,27 +49,35 @@ jobs:
4949
check_name: "Test Results ${{ matrix.python-version }}"
5050
github_retries: 10
5151
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'
5454
runs-on: ubuntu-latest
5555
needs: test
56+
outputs:
57+
current-version: ${{ steps.version-number.outputs.CURRENT_VERSION }}
5658
steps:
5759
- uses: actions/checkout@v2
5860
with:
5961
# Fetch all history instead of the latest commit
6062
fetch-depth: 0
61-
- name: Install dependencies
62-
run: |
63-
python -m pip install --upgrade pip
64-
pip install -r requirements.txt
6563
- name: Write version file
6664
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
6968
- 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
7179
- 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
7381
publish-pypi:
7482
if: github.repository == 'adobe/buildrunner'
7583
runs-on: ubuntu-latest
@@ -104,26 +112,20 @@ jobs:
104112
publish-docker:
105113
if: github.repository == 'adobe/buildrunner'
106114
runs-on: ubuntu-latest
107-
needs: test
115+
needs: [test, get-version]
108116
steps:
109117
- uses: actions/checkout@v2
110118
with:
111119
# Fetch all history instead of the latest commit
112120
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 }}
119121
- name: Docker Tags
120122
id: docker_tags
121123
uses: docker/metadata-action@v3
122124
with:
123125
images: ghcr.io/adobe/buildrunner
124126
tags: |
125127
latest
126-
${{ env.CURRENT_VERSION }}
128+
${{ needs.get-version.outputs.current-version }}
127129
- name: Set up QEMU
128130
uses: docker/setup-qemu-action@v1
129131
with:

0 commit comments

Comments
 (0)