diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..1d7597d --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,15 @@ +--- +name: Setup +description: Setup Node.js and install dependencies. + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: '16' + - name: Install dependencies + shell: bash + run: npm ci diff --git a/.github/workflows/codespaces.yml b/.github/workflows/codespaces.yml new file mode 100644 index 0000000..bbf8a17 --- /dev/null +++ b/.github/workflows/codespaces.yml @@ -0,0 +1,52 @@ +--- +name: codespaces + +on: + push: + branches: + - master + - codespaces + +jobs: + dotfiles: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.DEPLOY_KEY }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3 + id: import_gpg + with: + git-user-signingkey: true + git-commit-gpgsign: true + git-committer-name: ${{ secrets.GIT_USER_NAME }} + git-committer-email: ${{ secrets.GIT_USER_EMAIL }} + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Setup + uses: ./.github/actions/setup + - name: Build + run: npm run codespaces + - name: Publish latest + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.CODESPACES_DEPLOY_KEY }} + publish_dir: .codespaces + keep_files: true + external_repository: razor-x/dotfiles + publish_branch: master + user_name: ${{ secrets.GIT_USER_NAME }} + user_email: ${{ secrets.GIT_USER_EMAIL }} + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: '16' + - name: Install dependencies + shell: bash + run: npm ci diff --git a/.gitignore b/.gitignore index 020eef4..8528a19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.codespaces Gemfile.lock npm-debug.log bower_components/ diff --git a/codespaces/README.md b/codespaces/README.md new file mode 100644 index 0000000..ef9dff4 --- /dev/null +++ b/codespaces/README.md @@ -0,0 +1,7 @@ +# Codespaces dotfiles + +My dotfiles for [GitHub Codespaces]. +Generated from a subset of my [personal dotfiles]. + +[GitHub Codespaces]: https://github.com/features/codespaces +[personal dotfiles]: https://github.com/rxrc/dotfiles diff --git a/codespaces/manifest.js b/codespaces/manifest.js new file mode 100644 index 0000000..798cc04 --- /dev/null +++ b/codespaces/manifest.js @@ -0,0 +1,44 @@ +'use strict' + +const os = require('os') +const path = require('path') +const fs = require('fs') + +const host = 'codespaces' +const rxrc = 'node_modules/@rxrc' + +const targetRoot = path.resolve('.codespaces') + +const ioType = 'linux' +const pkgType = 'noop' + +const defaults = { + dmode: '0750', + fmode: '0640', + user: 'razorx', + group: 'razorx' +} + +const unlinks = [] + +const directories = [] + +const files = [{ + src: 'codespaces/README.md', + dst: 'README.md' +}, { + src: 'LICENSE.txt' +}] + +const symlinks = [] + +module.exports = async () => ({ + unlinks, + directories, + files, + symlinks, + targetRoot, + ioType, + pkgType, + defaults +}) diff --git a/package.json b/package.json index d95cdd5..1660892 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "curator", - "codespaces": "curator", + "codespaces": "curator codespaces/manifest.js", "postversion": "git push && git push --tags" }, "dependencies": {