Skip to content
Closed
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
69 changes: 32 additions & 37 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
{
"name": "PublicCodeEditor",
"dockerFile": "Dockerfile",
"runArgs": [
"--name",
"PublicCodeEditor_devcontainer"
],
"postCreateCommand": "sh .devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[go]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
}
},
"extensions": [
"dbaeumer.vscode-eslint",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"golang.go",
"firsttris.vscode-jest-runner",
"waderyan.gitblame"
]
}
},
"remoteUser": "root"
}
"name": "PublicCodeEditor",
"dockerFile": "Dockerfile",
"runArgs": ["--name", "PublicCodeEditor_devcontainer"],
"postCreateCommand": "sh .devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[go]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
}
},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"golang.go",
"firsttris.vscode-jest-runner",
"waderyan.gitblame"
]
}
}
}
2 changes: 2 additions & 0 deletions .devcontainer/githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
echo "Git pre-push hook"
echo "Run Build"
npm run build
echo "Run Lint"
npm run lint
echo "Run Test"
npm run test
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ extends:
- plugin:@typescript-eslint/recommended
- plugin:react/recommended
- plugin:react/jsx-runtime
- prettier
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: latest
sourceType: module
plugins:
- "@typescript-eslint"
- react
- prettier
rules:
react/prop-types: off
settings:
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Create Release PR
on:
workflow_dispatch:
inputs:
release_type:
description: 'Select type of release'
required: true
type: choice
default: patch
options:
- patch
- minor
- major

permissions:
contents: write
pull-requests: write
jobs:
create_release_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0

- name: Set up Git user
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- name: Get Next Version
id: nv
run:
echo "new_version=$(npx semver $(jq -r .version package.json) -i ${{ github.event.inputs.release_type }})" >> $GITHUB_OUTPUT

- name: Create release branch
run: |
RELEASE_BRANCH="release/${{ steps.nv.outputs.new_version }}"
git checkout -b "$RELEASE_BRANCH" develop
git push --set-upstream origin "$RELEASE_BRANCH"

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install deps
run: npm ci

- name: Update release version
run: |
RELEASE_BRANCH="release/${{ steps.nv.outputs.new_version }}"
git status
if [ -f package.json ]; then
npm version ${{ steps.nv.outputs.new_version }} --no-git-tag-version
git add package.json package-lock.json
fi
if [ -f publiccode.yml ]; then
node scripts/ci/updatePubliccodeReleaseDate.js
node scripts/ci/updatePubliccodeSoftwareVersion.js ${{ steps.nv.outputs.new_version }}
git add publiccode.yml
fi
git commit -m "chore: bump version to ${{ steps.nv.outputs.new_version }}" || echo "No changes to commit"
git push origin "$RELEASE_BRANCH"

- name: Create PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_BRANCH="release/${{ steps.nv.outputs.new_version }}"
git checkout "$RELEASE_BRANCH"
gh pr create -t "chore: release ${{ steps.nv.outputs.new_version }}" -b "Release ${{ steps.nv.outputs.new_version }}. Both Package version and publiccode.yml are already updated. Don't forget to edit CHANGELOG.md" -B main -l release
57 changes: 57 additions & 0 deletions .github/workflows/dependabot-on-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Recreate Dependabot PR on develop

on:
pull_request:
types: [opened]
branches:
- main

jobs:
rebase-dependabot-to-develop:
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Fetch full history and all branches
run: git fetch --unshallow --all

- name: Create a new branch from develop with dependabot changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ORIGINAL_BRANCH="${{ github.event.pull_request.head.ref }}"
NEW_BRANCH="dependabot-develop-${ORIGINAL_BRANCH}"

# Create new branch based on develop
git checkout origin/develop -b $NEW_BRANCH

# Get last commit message from original Dependabot branch
LAST_COMMIT_MSG=$(git log -1 --pretty=%B origin/$ORIGINAL_BRANCH)

# Merge Dependabot changes into the new branch
git merge --no-commit origin/$ORIGINAL_BRANCH || true
git commit -m "$LAST_COMMIT_MSG"
git push origin $NEW_BRANCH

# Create new pull request against develop
gh pr create \
--base develop \
--head $NEW_BRANCH \
--title "${{ github.event.pull_request.title }} (rebased onto develop)" \
--body "This is an automated copy of #${{ github.event.pull_request.number }}, targeting \`develop\` instead of \`main\`."

# Close the original PR
gh pr close ${{ github.event.pull_request.number }} --comment "Automatically closed: a new PR has been created against \`develop\`."

# Delete the original Dependabot branch
gh api \
-X DELETE \
repos/${{ github.repository }}/git/refs/heads/$ORIGINAL_BRANCH
13 changes: 5 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
on:
push:
branches:
- main
- cd-bund

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/setup-node@v6
with:
node-version: 20
- uses: actions/setup-go@v6
Expand All @@ -17,12 +17,9 @@ jobs:
- run: npm ci
- run: npm run build
env:
DEFAULT_COUNTRY_SECTION: italy
ELASTIC_URL: "https://elasticsearch.developers.italia.it/indicepa_pec/_search"
DEFAULT_COUNTRY_SECTION: switzerland
- run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/italia/publiccode-editor.git
echo publiccode-editor.developers.italia.it > dist/CNAME

npm run deploy -m "Automated deployment: ${CIRCLE_SHA1} [ci skip]"
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/swiss/publiccode-editor.git
npm run gdeploy -m "Automated deployment: ${CIRCLE_SHA1} [ci skip]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/finish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Finish Release PR
permissions:
contents: write
on:
pull_request:
branches:
- main
types:
- closed

jobs:
finish_release:
if: startsWith(github.head_ref, 'release/') && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git user
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- name: Get Version
id: v
run: |
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Attach a tag
run: |
git fetch
git checkout main
git tag v${{ steps.v.outputs.version }}
git push origin main
git push --tags
- name: Merge to Develop
run: |
git fetch
git checkout develop
git merge --no-ff main -m "chore: release ${{ steps.v.outputs.version }}"
git push origin develop
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.v.outputs.version }}
name: Release ${{ steps.v.outputs.version }}
body: "Automated release for tag v${{ steps.v.outputs.version }}"
draft: false
prerelease: false
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/setup-node@v6
with:
node-version: 20
- uses: actions/setup-go@v6
with:
go-version: '1.23.9'
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dist-ssr

# Editor directories and files
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
.idea
.DS_Store
Expand Down
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"golang.go",
"firsttris.vscode-jest-runner",
"waderyan.gitblame"
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[go]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
}
}
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @olibrian
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# publiccode yml Editor

This project is a fork of [italia/publiccode-editor](https://github.com/italia/publiccode-editor), customized to align with the Design System of the Swiss Confederation 🇨🇭.

For details about the Swiss Design System, see:

- [Design System for the Swiss Confederation (GitHub)](https://github.com/swiss/designsystem)
- [Design System for the Swiss Confederation (Stoybook)](https://swiss.github.io/designsystem/?path=/docs/get-started--docs)
- [Design System Core Library (Figma)](https://www.figma.com/design/3UYgqxmcJbG0hpWuti3y8U/🇨🇭Design-System-Core-Library)

The application is live at: https://swiss.github.io/publiccode-editor/

Below is the original README for the Italian version.

---

![Build Status](https://img.shields.io/circleci/project/github/italia/publiccode-editor/master.svg) ![Issues](https://img.shields.io/github/issues/italia/publiccode-editor.svg) ![License](https://img.shields.io/github/license/italia/publiccode-editor.svg) [![Join the #publiccode channel](https://img.shields.io/badge/Slack%20channel-%23publiccode-blue.svg?logo=slack)](https://developersitalia.slack.com/messages/CAM3F785T)
[![Get invited](https://slack.developers.italia.it/badge.svg)](https://slack.developers.italia.it/)

Expand Down
Loading
Loading