generated from OpenTermsArchive/demo-declarations
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 75520ff
Showing
18 changed files
with
10,459 additions
and
0 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,19 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
# Available options: daily, weekly or monthly | ||
interval: "daily" | ||
# Has to be formatted as hh:mm | ||
time: "06:06" | ||
# List of time zones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | ||
timezone: "Europe/Paris" | ||
# Allow updates for Open Terms Archive engine | ||
allow: | ||
- dependency-name: "@opentermsarchive/engine" | ||
# Open Terms Archive recommends to always add the collection maintainer team as a reviewer so they are notified of the update | ||
reviewers: | ||
- "OpenTermsArchive/demo" | ||
# Avoid having too many open pull requests | ||
open-pull-requests-limit: 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,42 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
uses: "./.github/workflows/test.yml" | ||
|
||
deploy: | ||
needs: [ test ] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get target server hostname | ||
id: get_hostname | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq '.all.hosts.* | key' deployment/inventory.yml | ||
- name: Get target server fingerprint | ||
id: get_fingerprint | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq '.all.hosts.*.ed25519_fingerprint' deployment/inventory.yml | ||
- name: Set up SSH | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SERVER_SSH_KEY }} | ||
known_hosts: ${{ steps.get_hostname.outputs.result }} ssh-ed25519 ${{ steps.get_fingerprint.outputs.result }} | ||
- run: echo "${{ secrets.ANSIBLE_VAULT_KEY }}" > deployment/vault.key | ||
- run: pip install --upgrade setuptools | ||
- run: pip install 'ansible ~= 2.9' | ||
- name: Install dependencies | ||
working-directory: ./deployment | ||
run: ansible-galaxy collection install -p ./ -r requirements.yml --force | ||
- name: Deploy | ||
working-directory: ./deployment | ||
run: ansible-playbook ./ansible_collections/opentermsarchive/deployment/playbooks/engine/all.yml | ||
|
||
|
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,78 @@ | ||
name: first-time-setup | ||
run-name: Setup | ||
|
||
on: | ||
# Run when repo is generated from template | ||
create: | ||
|
||
# Only keep latest run of this workflow | ||
concurrency: | ||
group: first-time-setup | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
actions: write | ||
checks: write | ||
contents: write | ||
|
||
|
||
jobs: | ||
first-time-setup: | ||
# Ensure this action is run only once | ||
if: github.run_number == 1 | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set environment variables | ||
run: | | ||
echo "REPOSITORY_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV && | ||
echo "REPOSITORY_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV && | ||
echo "COLLECTION_NAME=$(echo ${{ github.event.repository.name }} | sed 's/-declarations//')" >> $GITHUB_ENV && | ||
echo "PLACEHOLDER=_ _ _ _ _ ✍️" >> $GITHUB_ENV | ||
- name: Remove first time setup workflow | ||
run: rm -f .github/workflows/first-time-setup.yml | ||
|
||
- name: Remove declarations | ||
run: rm -f declarations/* | ||
|
||
- name: Update dependabot | ||
run: | | ||
sed -i "s|"OpenTermsArchive/demo"|"$REPOSITORY_OWNER/$REPOSITORY_NAME"|g" .github/dependabot.yml | ||
- name: Cleanup deployment inventory | ||
run: | | ||
content="all: | ||
hosts: | ||
$PLACEHOLDER: | ||
ansible_user: $PLACEHOLDER | ||
ed25519_fingerprint: $PLACEHOLDER | ||
ota_engine_declarations_branch: $PLACEHOLDER | ||
ota_engine_github_bot_private_key: $PLACEHOLDER | ||
ota_engine_github_token: $PLACEHOLDER | ||
ota_engine_smtp_password: $PLACEHOLDER" | ||
echo "$content" > deployment/inventory.yml | ||
|
||
- name: Update config | ||
run: | | ||
sed -i "s|demo|$COLLECTION_NAME|g" config/production.json && | ||
sed -i "s|OpenTermsArchive|$REPOSITORY_OWNER|g" config/production.json | ||
- name: Update README | ||
run: | | ||
sed -i "s|<!-- here goes your collection name -->.*<!-- until here -->|$COLLECTION_NAME|g" README.md && | ||
sed -i "s|OpenTermsArchive/demo-versions|$REPOSITORY_OWNER/$COLLECTION_NAME-versions|g" README.md && | ||
sed -i "s|<!-- customize to your context -->.*<!-- until here -->|$PLACEHOLDER|g" README.md | ||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Adapt template automatically" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,47 @@ | ||
name: Validate declarations | ||
|
||
on: | ||
pull_request: | ||
workflow_call: | ||
|
||
jobs: | ||
validate_schema: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm run test:schema | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm run lint | ||
|
||
validate_modified_declarations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # fetch all history for all branches and tags | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm run test:modified | ||
- name: Generate artifacts | ||
if: ${{ failure() }} | ||
run: npm run start:modified | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: snapshots_and_versions | ||
path: ./data | ||
if-no-files-found: error |
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,4 @@ | ||
.DS_Store | ||
node_modules | ||
data | ||
vault.key |
Oops, something went wrong.