Skip to content

Commit e74bd92

Browse files
authored
TK-19082 Implement publish-dev (#1036)
1 parent 078cc26 commit e74bd92

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Reset Dev Documentation Branch
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * 1'
7+
8+
jobs:
9+
reset-docs-branch:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Determine default branch
18+
id: default_branch
19+
env:
20+
GH_TOKEN: ${{ github.token }}
21+
run: |
22+
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef -q '.defaultBranchRef.name')
23+
echo "Default branch is $DEFAULT_BRANCH"
24+
echo "default_branch=$DEFAULT_BRANCH" >> "$GITHUB_OUTPUT"
25+
26+
- name: Reset dev branch
27+
run: |
28+
git fetch origin ${{ steps.default_branch.outputs.default_branch }}
29+
git checkout ${{ vars.DEV_BRANCH }}
30+
git reset --hard origin/${{ steps.default_branch.outputs.default_branch }}
31+
git push origin ${{ vars.DEV_BRANCH }} --force

.github/workflows/run.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
pull-request: ${{ steps.PR.outputs.number }}
5656
pull-request-title: ${{ steps.PR.outputs.pr_title }}
5757
skip-jira: ${{ github.ref_name != github.event.repository.default_branch && contains(steps.PR.outputs.pr_labels, 'skip-jira') }}
58+
publish-dev: ${{ github.ref_name != github.event.repository.default_branch && contains(steps.PR.outputs.pr_labels, 'publish-dev') }}
5859

5960
jira:
6061
name: "JIRA"
@@ -102,4 +103,16 @@ jobs:
102103
name: Tools
103104
needs: [pr-info, frontmatter]
104105
uses: ./.github/workflows/build.yml
105-
secrets: inherit
106+
secrets: inherit
107+
108+
publish-dev:
109+
name: Publish Dev
110+
uses: OutSystems/tk-cicd/.github/workflows/auto-publish.yml@main
111+
needs: [pr-info, tools]
112+
if: needs.pr-info.outputs.publish-dev == 'true'
113+
with:
114+
target-branch: ${{ vars.DEV_BRANCH }}
115+
pr-number: ${{ needs.pr-info.outputs.pull-request }}
116+
changed-files: ${{ needs.pr-info.outputs.changed-files }}
117+
secrets:
118+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)