Merge pull request #40 from kluctl/fix-modtimes #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
env: | |
PYTHON_STANDALONE_VERSIONS: | | |
[ | |
"20240224" | |
] | |
PYTHON_VERSIONS: | | |
[ | |
"3.10.13", | |
"3.11.8", | |
"3.12.2" | |
] | |
jobs: | |
build-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
PYTHON_STANDALONE_VERSIONS: ${{ env.PYTHON_STANDALONE_VERSIONS }} | |
PYTHON_VERSIONS: ${{ env.PYTHON_VERSIONS }} | |
steps: | |
- name: noop | |
run: | | |
echo noop | |
build-tag: | |
needs: | |
- build-matrix | |
strategy: | |
matrix: | |
pythonStandaloneVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_STANDALONE_VERSIONS) }} | |
pythonVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_VERSIONS) }} | |
fail-fast: false | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
run: | | |
# can't use actions/checkout here as transferring the shallow clone fails when using upload-/download-artifact | |
git clone https://token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY . --depth=1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ matrix.pythonStandaloneVersion }}-${{ matrix.pythonVersion }}-build-tag-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.pythonStandaloneVersion }}-${{ matrix.pythonVersion }}-build-tag- | |
- name: build-tag | |
run: | | |
git config --global user.email "no@mail.exists" | |
git config --global user.name "go-embed-python releaser" | |
BUILD_NUM=$(./hack/next-build-num.sh ${{ matrix.pythonStandaloneVersion }} ${{ matrix.pythonVersion }}) | |
./hack/build-tag.sh ${{ matrix.pythonStandaloneVersion }} ${{ matrix.pythonVersion }} $BUILD_NUM | |
echo $BUILD_NUM > build-num | |
- name: git gc | |
run: | | |
git gc | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: workdir-${{ matrix.pythonStandaloneVersion }} ${{ matrix.pythonVersion }} | |
path: | | |
.git | |
build-num | |
tests: | |
needs: | |
- build-matrix | |
- build-tag | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-11 | |
- windows-2019 | |
pythonStandaloneVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_STANDALONE_VERSIONS) }} | |
pythonVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_VERSIONS) }} | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ matrix.pythonStandaloneVersion }}-${{ matrix.pythonVersion }}-tests-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.pythonStandaloneVersion }}-${{ matrix.pythonVersion }}-tests- | |
- uses: actions/download-artifact@v4 | |
with: | |
name: workdir-${{ matrix.pythonStandaloneVersion }} ${{ matrix.pythonVersion }} | |
- name: checkout tag | |
shell: bash | |
run: | | |
git reset --hard | |
git checkout v0.0.0-${{ matrix.pythonVersion }}-${{ matrix.pythonStandaloneVersion }}-$(cat build-num) | |
- name: run tests | |
shell: bash | |
run: | | |
go test ./... -v | |
release: | |
needs: | |
- build-matrix | |
- tests | |
strategy: | |
matrix: | |
pythonStandaloneVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_STANDALONE_VERSIONS) }} | |
pythonVersion: ${{ fromJSON(needs.build-matrix.outputs.PYTHON_VERSIONS) }} | |
fail-fast: false | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
permissions: | |
contents: write | |
actions: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: workdir-${{ matrix.pythonStandaloneVersion }} ${{ matrix.pythonVersion }} | |
- name: update remote url | |
run: | | |
git remote set-url origin https://token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: push tag | |
run: | | |
git push origin v0.0.0-${{ matrix.pythonVersion }}-${{ matrix.pythonStandaloneVersion }}-$(cat build-num) |