-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shane Osbourne
committed
Nov 8, 2024
1 parent
0cdcce5
commit 47bc86a
Showing
198 changed files
with
231 additions
and
41,339 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: PR Build and Release | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, closed, ready_for_review] | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
if: github.event.action != 'closed' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js from .nvmrc | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: npm ci --verbose | ||
|
||
- name: Run build | ||
run: npm run build | ||
|
||
- name: Create and push release branch | ||
id: create_branch | ||
env: | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git checkout -b pr-releases/pr-${PR_NUMBER} | ||
git add -f build | ||
git commit -m "Add build folder for PR ${PR_NUMBER}" | ||
git push -u origin pr-releases/pr-${PR_NUMBER} --force | ||
echo "BRANCH_NAME=pr-releases/pr-${PR_NUMBER}" >> $GITHUB_ENV | ||
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV | ||
- name: Find Previous Comment | ||
uses: peter-evans/find-comment@v3 | ||
id: find_comment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: 'Temporary Branch Update' | ||
direction: last | ||
|
||
- name: Create Comment Body | ||
uses: actions/github-script@v7 | ||
id: create_body | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const branchName = process.env.BRANCH_NAME; | ||
const commitHash = process.env.COMMIT_HASH; | ||
const prNumber = context.issue.number; | ||
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`; | ||
const branchUrl = `${repoUrl}/tree/${branchName}`; | ||
const commitUrl = `${repoUrl}/commit/${commitHash}`; | ||
const commentBody = ` | ||
### Temporary Branch Update | ||
The temporary branch has been updated with the latest changes. Below are the details: | ||
- **Branch Name**: [${branchName}](${branchUrl}) | ||
- **Commit Hash**: [${commitHash}](${commitUrl}) | ||
**NPM** | ||
\`\`\`bash | ||
npm i github:duckduckgo/privacy-dashboard#${commitHash} | ||
\`\`\` | ||
**Git submodule:** | ||
\`\`\`bash | ||
git submodule update --remote --init submodules/privacy-dashboard | ||
cd submodules/privacy-dashboard | ||
git fetch origin | ||
git checkout pr-releases/pr-227 | ||
git reset --hard origin/pr-releases/pr-227 | ||
\`\`\` | ||
**Swift** | ||
|
||
\`\`\`swift | ||
.package(url: "https://github.com/duckduckgo/privacy-dashboard", revision: "${commitHash}"), | ||
\`\`\` | ||
`; | ||
core.setOutput('comment_body', commentBody); | ||
core.setOutput('pr_number', prNumber); | ||
- name: Create, or Update the Comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-id: ${{ steps.find_comment.outputs.comment-id }} | ||
body: ${{ steps.create_body.outputs.comment_body }} | ||
edit-mode: replace | ||
clean_up: | ||
if: github.event.action == 'closed' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Delete release branch | ||
env: | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git push origin --delete pr-releases/pr-${PR_NUMBER} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
description: 'Release version' | ||
|
||
jobs: | ||
release_pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Fetch files and ensure branches exist | ||
run: | | ||
git fetch origin | ||
if [ -f .git/shallow ]; then | ||
echo "Shallow repo clone, unshallowing" | ||
git fetch --unshallow | ||
fi | ||
git fetch --tags | ||
# Check if the 'main' branch exists, if not, create it | ||
if git rev-parse --verify main >/dev/null 2>&1; then | ||
git checkout main | ||
else | ||
git checkout -b main origin/main | ||
fi | ||
# Check if the 'releases' branch exists, if not, create it | ||
if git rev-parse --verify releases >/dev/null 2>&1; then | ||
git checkout releases | ||
else | ||
git checkout -b releases origin/releases | ||
fi | ||
- name: Collect commit ranges | ||
run: | | ||
bash ./scripts/changelog.sh > ${{ github.workspace }}/CHANGELOG.txt | ||
- name: Debug changelog file | ||
run: | | ||
ls -la ${{ github.workspace }}/CHANGELOG.txt | ||
cat ${{ github.workspace }}/CHANGELOG.txt | ||
echo "Current tag is: $(git rev-list --tags --max-count=1)" | ||
- name: Checkout code from main into release branch | ||
run: | | ||
# Checkout the code of main onto releases | ||
git checkout main -- . | ||
- name: Build release | ||
run: | | ||
npm ci | ||
npm run build | ||
- name: Check in files | ||
run: | | ||
git add -f build/ | ||
- name: Commit build files | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: 'Release build ${{ github.event.inputs.version }} [ci release]' | ||
commit_options: '--allow-empty' | ||
skip_checkout: true | ||
branch: 'releases' | ||
|
||
- name: Debug changelog file | ||
run: | | ||
ls -la ${{ github.workspace }}/CHANGELOG.txt | ||
cat ${{ github.workspace }}/CHANGELOG.txt | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body_path: ${{ github.workspace }}/CHANGELOG.txt | ||
draft: false | ||
prerelease: false | ||
tag_name: ${{ github.event.inputs.version }} | ||
target_commitish: 'releases' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Test & Deploy Docs | ||
on: | ||
pull_request: | ||
# pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18 | ||
22 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.