Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Build using Github Actions #12

Merged
merged 3 commits into from
Aug 29, 2023
Merged
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
19 changes: 19 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build and test PR

on:
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm install
- run: npm run download
- run: npm run transform
5 changes: 5 additions & 0 deletions .github/workflows/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cp build/fylke.json destinationRepo/
cp build/fylke.schema.json destinationRepo/
cp build/kommune.json destinationRepo/
cp build/kommune.schema.json destinationRepo/
tar cf artifacts.tar build
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build and publish kommune

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm install
- run: npm update
- run: npm run download
- run: npm run transform
- name: Check downloaded files
run: ./.github/workflows/filecheck.sh
- name: Checkout
uses: actions/checkout@v3
with:
path: './destinationRepo'
token: ${{secrets.PUSH_TOKEN}}
- name: Run deployment script
run: ./.github/workflows/deploy.sh
shell: bash
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts.tar"
tag: v_${{ github.run_number }}
- name: post to slack
run: ./.github/workflows/slack.sh ${{ secrets.POST_SLACK }}
shell: bash
- name: Push to kommune
run: |
cd destinationRepo
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
git config --global --list
git stage .
git commit -m "Updated from kommune v_${{ github.run_number }}"
git branch --set-upstream-to master
git push https://$USERNAME:$REPO_KEY@github.com/artsdatabanken/kommune.git
env:
REPO_KEY: ${{secrets.PUSH_TOKEN}}
USERNAME: github-actions[bot]
2 changes: 2 additions & 0 deletions .github/workflows/filecheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ls -l temp
ls -l build
1 change: 1 addition & 0 deletions .github/workflows/slack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export curl -X POST -H 'Content-type: application/json' --data '{"text":"deploy stedsnavn-lastejobb"}' $1
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.