add ideditor staging workflow

upgrade github actions to most recent versions, move secrets to dedicated gh environments
This commit is contained in:
Martin Raifer 2025-02-13 13:23:32 +01:00
parent 54fc704a25
commit db8046f762
No known key found for this signature in database
GPG key ID: 3CD561F7B1C461BD
8 changed files with 27447 additions and 26 deletions

View file

@ -12,13 +12,13 @@ jobs:
build-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm clean-install
- run: npm run dist
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: openstreetmap/iD
path: './iD'

View file

@ -8,17 +8,17 @@ on:
jobs:
deploy-preview:
environment: pr-previews
runs-on: ubuntu-latest
if: ${{github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'}}
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
- run: npm install --global netlify-cli@6
- run: npm install unzipper@0.10
- run: npm clean-install
- name: Get pull request number
uses: actions/github-script@v6
uses: actions/github-script@v7
id: pull-request-number
with:
result-encoding: string
@ -45,7 +45,7 @@ jobs:
const file = directory.files.find(d => d.path === 'pr_number');
const content = await file.buffer();
return content.toString();
- uses: dawidd6/action-download-artifact@v6
- uses: dawidd6/action-download-artifact@v8
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-preview.yml
@ -56,10 +56,10 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}}
NETLIFY_SITE_ID: ${{secrets.NETLIFY_SITE_ID}}
run: netlify deploy --dir=. --alias=pr-${{steps.pull-request-number.outputs.result}}
run: ./node_modules/.bin/netlify deploy --dir=. --alias=pr-${{steps.pull-request-number.outputs.result}}
- name: Add comment to pull request
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const pullRequestNumber = parseInt(${{steps.pull-request-number.outputs.result}}, 10);
@ -85,7 +85,7 @@ jobs:
}
- name: Clean up artifact
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
result-encoding: string
script: |

View file

@ -12,15 +12,15 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: "github.repository == 'openstreetmap/id-tagging-schema'"
if: github.repository == 'openstreetmap/id-tagging-schema'
steps:
- name: Checkout
uses: actions/checkout@v3 # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly.
uses: actions/checkout@v4 # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
@ -31,7 +31,7 @@ jobs:
run: npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.1
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: interim # The branch the action should deploy to.
FOLDER: interim # The folder the action should deploy.
branch: interim # The branch the action should deploy to.
folder: interim # The folder the action should deploy.

View file

@ -5,7 +5,7 @@ jobs:
name: Check file endings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
disallowedFiles=`find data/ -type f -not -iname "*.json" -not -iname "*.md"`
for f in $disallowedFiles
@ -18,8 +18,8 @@ jobs:
name: Check for code formatting mistakes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm clean-install
@ -29,8 +29,8 @@ jobs:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@master
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
skip: ./.git,./dist,./data/deprecated.json,./data/discarded.json

57
.github/workflows/staging.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: Build and Deploy Staging Instance
on:
push:
branches: [ main ]
permissions:
contents: read
jobs:
build-deploy:
if: github.repository == 'openstreetmap/id-tagging-schema'
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# install and build development version of id-tagging-schema
- run: npm clean-install
- run: npm run translations
env:
transifex_password: ${{secrets.TX_TOKEN}}
if: env.transifex_password != null
- run: npm run dist
# install and build development version of iD using freshest version of presets and ELI
- uses: actions/checkout@v4
with:
repository: openstreetmap/id
path: './iD'
- run: npm clean-install
working-directory: './iD'
- run: npm install editor-layer-index
working-directory: './iD'
- run: mkdir dist/data
working-directory: './iD'
- run: npm run imagery
working-directory: './iD'
- run: npm run all
working-directory: './iD'
- run: npm run translations
working-directory: './iD'
env:
transifex_password: ${{secrets.TX_TOKEN}}
if: env.transifex_password != null
- run: mkdir iD/dist/id-tagging-schema && mv dist iD/dist/id-tagging-schema/dist
- run: npm run dist
working-directory: './iD'
env:
ID_PRESETS_CDN_URL: './id-tagging-schema/'
# deploy to netlify
- name: Deploy to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}}
NETLIFY_SITE_ID: ${{secrets.NETLIFY_SITE_ID}}
run: ./node_modules/.bin/netlify deploy --prod --dir=iD/dist

View file

@ -18,9 +18,9 @@ jobs:
node-version: ['18']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm clean-install