Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix release ci #2589

Merged
merged 26 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b12bfc7
feat: fix release ci
dejanzele Jun 20, 2023
9a31a86
Merge branch 'master' into feat/release-ci-fix
dejanzele Jun 20, 2023
c70d4da
Merge branch 'master' into feat/release-ci-fix
dejanzele Jun 28, 2023
45e1c9e
change release workflows to depend on ci workflow
dejanzele Jun 28, 2023
e3cb0f2
Merge branch 'master' into feat/release-ci-fix
dejanzele Jul 5, 2023
dffbc55
Merge branch 'master' of github.com:G-Research/armada into feat/relea…
dejanzele Jul 5, 2023
46699a9
update rc job
dejanzele Jul 5, 2023
465125e
Merge branch 'feat/release-ci-fix' of github.com:dejanzele/armada int…
dejanzele Jul 5, 2023
3f699bf
test release job
dejanzele Jul 5, 2023
543bf63
add protection for branch/tag name injection
dejanzele Jul 5, 2023
df75372
Feat/release ci fix (#44)
dejanzele Jul 5, 2023
2ac8d91
rename main to master branch in release rc job
dejanzele Jul 5, 2023
ce1088c
Merge branch 'master' into feat/release-ci-fix
dejanzele Jul 5, 2023
8bbe495
Merge branch 'master' of github.com:dejanzele/armada
dejanzele Jul 5, 2023
5d398f9
Feat/release ci fix (#45)
dejanzele Jul 5, 2023
7183abe
change release jobs to target master
dejanzele Jul 5, 2023
efd7c43
Merge branch 'feat/release-ci-fix' of github.com:dejanzele/armada int…
dejanzele Jul 5, 2023
3250a19
Merge branch 'master' into feat/release-ci-fix
dejanzele Jul 5, 2023
b6becaa
final polish for release workflow
dejanzele Jul 5, 2023
284d27a
remove redundat validate workflow
dejanzele Jul 5, 2023
687f8c4
Merge branch 'master' into feat/release-ci-fix
dejanzele Jul 6, 2023
bd57eb5
fix minor issues in release workflows
dejanzele Jul 6, 2023
1f13228
Merge branch 'feat/release-ci-fix' of github.com:dejanzele/armada int…
dejanzele Jul 6, 2023
0d0901f
fix error comments in release workflow
dejanzele Jul 6, 2023
9699756
update release workflow and polish it
dejanzele Jul 6, 2023
211fbf7
Merge branch 'master' into feat/release-ci-fix
dejanzele Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
tags:
- v*
branches-ignore:
- gh-pages
pull_request:
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/release-rc.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
name: Release Armada components - RC

on:
push:
workflow_run:
types: [completed]
workflows: [CI]
branches:
- main
- master

permissions:
contents: write

jobs:
validate:
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'armadaproject'
name: "Validate revision"
runs-on: ubuntu-22.04

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 0

# The given ref should belong to the master branch.
# If it's master, it shouldn't be more than 2 commits away (in case another push happened in the meantime).
# Anything else is invalid.
- name: Validate ref
dejanzele marked this conversation as resolved.
Show resolved Hide resolved
run: |
ref='${{ github.event.workflow_run.head_branch }}'
sha='${{ github.event.workflow_run.head_sha }}'

[ "$ref" == "master" ] &&
[ $(git branch --contains=$sha master | wc -l) -eq 1 ] &&
[ $(git rev-list --count $sha..master) -le 2 ]
if [ $? -ne 0 ]; then
echo "::error ::Invalid ref $ref $sha: must be a merge to master branch and not more than 2 commits away"
exit 1
fi
release:
if: github.repository_owner == 'armadaproject'
name: Release
needs: validate
runs-on: "ubuntu-22.04"
environment: armada-dockerhub

Expand Down
36 changes: 32 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
name: Release Armada components

on:
push:
tags:
- 'v*'
workflow_run:
types: [completed]
workflows: [CI]
branches:
- v*

permissions:
contents: write

jobs:
validate:
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'armadaproject'
name: "Validate revision"
runs-on: ubuntu-22.04

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 0

# The given ref should belong to the master branch.
# If it starts with 'v', it should be a tag, belong to the master branch and match the semver regex.
# Anything else is invalid.
- name: Validate ref
run: |
ref='${{ github.event.workflow_run.head_branch }}'
sha='${{ github.event.workflow_run.head_sha }}'

[[ $ref =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] &&
[ $(git rev-parse refs/tags/$ref) == $sha ] &&
[ $(git branch --contains=$sha master | wc -l) -eq 1 ]
if [ $? -ne 0 ]; then
echo "::error ::Invalid ref $ref $sha: must be a tag, belong to the master branch and match the semver regex"
exit 1
fi
release:
if: github.repository_owner == 'armadaproject'
name: "Release"
needs: validate
runs-on: ubuntu-22.04
environment: armada-dockerhub

Expand Down