Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Align files #81

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
architect: giantswarm/architect@4.15.0
architect: giantswarm/architect@4.33.0

workflows:
test:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/zz_generated.add-team-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Add appropriate labels to issue

on:
issues:
types: [assigned]

jobs:
build_user_list:
name: Get yaml config of GS users
runs-on: ubuntu-latest
steps:
- name: Get user-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/users.yaml \
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/user-mapping.yaml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: users
path: artifacts/users.yaml
retention-days: 1

add_label:
name: Add team label when assigned
runs-on: ubuntu-latest
needs: build_user_list
steps:
- uses: actions/download-artifact@v3
id: download-users
with:
name: users
- name: Find team label based on user names
run: |
event_assignee=$(cat $GITHUB_EVENT_PATH | jq -r .assignee.login | tr '[:upper:]' '[:lower:]')
echo "Issue assigned to: ${event_assignee}"

TEAMS=$(cat ${{steps.download-users.outputs.download-path}}/users.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_assignee}.teams" -o csv | tr ',' ' ')

echo "LABEL<<EOF" >> $GITHUB_ENV
for team in ${TEAMS}; do
echo "Team: ${team} | Label: team/${team}"
echo "team/${team}" >> $GITHUB_ENV
done
echo "EOF" >> $GITHUB_ENV
- name: Apply label to issue
if: ${{ env.LABEL != '' && env.LABEL != 'null' && env.LABEL != null }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.ISSUE_AUTOMATION }}
labels: |
${{ env.LABEL }}
89 changes: 89 additions & 0 deletions .github/workflows/zz_generated.add-to-project-board.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Add Issue to Project when assigned

on:
issues:
types:
- assigned
- labeled

jobs:
build_user_list:
name: Get yaml config of GS users
runs-on: ubuntu-latest
steps:
- name: Get user-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/users.yaml \
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/user-mapping.yaml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: users
path: artifacts/users.yaml
retention-days: 1
- name: Get label-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/labels.yaml \
https://raw.githubusercontent.com/giantswarm/github/main/tools/issue-automation/label-mapping.yaml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: labels
path: artifacts/labels.yaml
retention-days: 1

add_to_personal_board:
name: Add issue to personal board
runs-on: ubuntu-latest
needs: build_user_list
if: github.event.action == 'assigned'
steps:
- uses: actions/download-artifact@v3
id: download-users
with:
name: users
- name: Find personal board based on user names
run: |
event_assignee=$(cat $GITHUB_EVENT_PATH | jq -r .assignee.login | tr '[:upper:]' '[:lower:]')
echo "Issue assigned to: ${event_assignee}"

BOARD=($(cat ${{steps.download-users.outputs.download-path}}/users.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_assignee}.personalboard"))
echo "Personal board URL: ${BOARD}"

echo "BOARD=${BOARD}" >> $GITHUB_ENV
- name: Add issue to personal board
if: ${{ env.BOARD != 'null' && env.BOARD != '' && env.BOARD != null }}
uses: actions/add-to-project@main
with:
project-url: ${{ env.BOARD }}
github-token: ${{ secrets.ISSUE_AUTOMATION }}

add_to_team_board:
name: Add issue to team board
runs-on: ubuntu-latest
needs: build_user_list
if: github.event.action == 'labeled'
steps:
- uses: actions/download-artifact@v3
id: download-labels
with:
name: labels
- name: Find team board based on label
run: |
event_label=$(cat $GITHUB_EVENT_PATH | jq -r .label.name | tr '[:upper:]' '[:lower:]')
echo "Issue labelled with: ${event_label}"

BOARD=($(cat ${{steps.download-labels.outputs.download-path}}/labels.yaml | tr '[:upper:]' '[:lower:]' | yq ".[\"${event_label}\"].projectboard"))
echo "Team board URL: ${BOARD}"

echo "BOARD=${BOARD}" >> $GITHUB_ENV
- name: Add issue to team board
if: ${{ env.BOARD != 'null' && env.BOARD != '' && env.BOARD != null }}
uses: actions/add-to-project@main
with:
project-url: ${{ env.BOARD }}
github-token: ${{ secrets.ISSUE_AUTOMATION }}
57 changes: 31 additions & 26 deletions .github/workflows/zz_generated.create_release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.24.1
# devctl@6.14.0
#
name: Create Release
on:
Expand All @@ -15,7 +15,7 @@ on:
jobs:
debug_info:
name: Debug info
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Print github context JSON
run: |
Expand All @@ -24,7 +24,7 @@ jobs:
EOF
gather_facts:
name: Gather facts
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
project_go_path: ${{ steps.get_project_go_path.outputs.path }}
ref_version: ${{ steps.ref_version.outputs.refversion }}
Expand All @@ -50,10 +50,10 @@ jobs:
fi
version="${version#v}" # Strip "v" prefix.
echo "version=\"${version}\""
echo "::set-output name=version::${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Checkout code
if: ${{ steps.get_version.outputs.version != '' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get project.go path
id: get_project_go_path
if: ${{ steps.get_version.outputs.version != '' }}
Expand All @@ -63,7 +63,7 @@ jobs:
path=''
fi
echo "path=\"$path\""
echo "::set-output name=path::${path}"
echo "path=${path}" >> $GITHUB_OUTPUT
- name: Check if reference version
id: ref_version
run: |
Expand All @@ -81,29 +81,29 @@ jobs:
refversion=true
fi
echo "refversion =\"${refversion}\""
echo "::set-output name=refversion::${refversion}"
echo "refversion=${refversion}" >> $GITHUB_OUTPUT
update_project_go:
name: Update project.go
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: ${{ needs.gather_facts.outputs.version != '' && needs.gather_facts.outputs.project_go_path != '' && needs.gather_facts.outputs.ref_version != 'true' }}
needs:
- gather_facts
steps:
- name: Install architect
uses: giantswarm/install-binary-action@v1.0.0
uses: giantswarm/install-binary-action@v1.1.0
with:
binary: "architect"
version: "6.1.0"
version: "6.11.0"
- name: Install semver
uses: giantswarm/install-binary-action@v1.0.0
uses: giantswarm/install-binary-action@v1.1.0
with:
binary: "semver"
version: "3.2.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Update project.go
id: update_project_go
env:
Expand All @@ -114,45 +114,47 @@ jobs:
version="${{ needs.gather_facts.outputs.version }}"
new_version="$(semver bump patch $version)-dev"
echo "version=\"$version\" new_version=\"$new_version\""
echo "::set-output name=new_version::${new_version}"
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
sed -Ei "s/(version[[:space:]]*=[[:space:]]*)\"${version}\"/\1\"${new_version}\"/" $file
if git diff --exit-code $file ; then
echo "error: no changes in \"$file\"" >&2
exit 1
fi
- name: Set up git identity
run: |
git config --local user.email "dev@giantswarm.io"
git config --local user.name "taylorbot"
- name: Commit changes
run: |
file="${{ needs.gather_facts.outputs.project_go_path }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add $file
git commit -m "Bump version to ${{ steps.update_project_go.outputs.new_version }}"
- name: Push changes
env:
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git"
branch: "${{ github.ref }}-version-bump"
run: |
git push "${REMOTE_REPO}" HEAD:${{ env.branch }}
- name: Create PR
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}"
base: "${{ github.ref }}"
branch: "${{ github.ref }}-version-bump"
version: "${{ needs.gather_facts.outputs.version }}"
title: "Bump version to ${{ steps.update_project_go.outputs.new_version }}"
run: |
hub pull-request -f -m "${{ env.title }}" -b ${{ env.base }} -h ${{ env.branch }} -r ${{ github.actor }}
gh pr create --title "${{ env.title }}" --body "" --base ${{ env.base }} --head ${{ env.branch }} --reviewer ${{ github.actor }}
create_release:
name: Create release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
outputs:
upload_url: ${{ steps.create_gh_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Ensure correct version in project.go
Expand All @@ -167,43 +169,46 @@ jobs:
with:
version: ${{ needs.gather_facts.outputs.version }}
path: ./CHANGELOG.md
- name: Set up git identity
run: |
git config --local user.email "dev@giantswarm.io"
git config --local user.name "taylorbot"
- name: Create tag
run: |
version="${{ needs.gather_facts.outputs.version }}"
git config --local user.name "github-actions"
git tag "v$version" ${{ github.sha }}
- name: Push tag
env:
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
REMOTE_REPO: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git"
run: |
git push "${REMOTE_REPO}" --tags
- name: Create release
id: create_gh_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}"
with:
body: ${{ steps.changelog_reader.outputs.changes }}
tag_name: "v${{ needs.gather_facts.outputs.version }}"
release_name: "v${{ needs.gather_facts.outputs.version }}"

create-release-branch:
name: Create release branch
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
steps:
- name: Install semver
uses: giantswarm/install-binary-action@v1.0.0
uses: giantswarm/install-binary-action@v1.1.0
with:
binary: "semver"
version: "3.0.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Clone the whole history, not just the most recent commit.
- name: Fetch all tags and branches
Expand Down
Loading