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

How would you automate updating vscode extensions? #13

Closed
hydrajump opened this issue Dec 13, 2023 · 4 comments
Closed

How would you automate updating vscode extensions? #13

hydrajump opened this issue Dec 13, 2023 · 4 comments

Comments

@hydrajump
Copy link

I'm considering using this project instead of the old extensions packaged in nixpkgs in my home-manager standalone config.

It seems that the steps to update the extensions would look like this:

  1. nix flake update
  2. Get the rev of nixpkgs from the flake.lock
  3. Find the latest vscode version using the nixpkgs rev from step 2:
    https://github.com/NixOS/nixpkgs/blob/e92039b55bcd58469325ded85d4f58dd5a4eaf58/pkgs/applications/editors/vscode/vscode.nix#L43
  4. Update vscode_version in config.toml with version from step 3
  5. Get the latest vscode extensions for the version in step 4, cargo run -- config.toml
  6. Update home manager config home-manager switch --flake .

Is there a more convenient way to do this?

@cathaysia
Copy link
Collaborator

Generally speaking, I rarely update the entire flake.lock. I will update vscode extension regularly. This step is completed through github actions.

@hydrajump
Copy link
Author

Can you share your github action for how you update your extensions? Is it a pull request that yo occasionally accept and then pull down your repo and rebuild your HM config?

@cathaysia
Copy link
Collaborator

just like this:

name: CI

on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * 5"

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
      - name: Install Nix
        uses: cachix/install-nix-action@v18
        with:
          extra_nix_config: |
            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
      - run: cargo +nightly install --git https://github.com/cathaysia/nix4vscode
      - name: Update vscode extension
        run: |
          bash -c 'cd home/dot_config/home-manager && nix flake update "nix-vscode-extensions"'
          bash -c 'nix4vscode home/dot_config/home-manager/config.toml -o home/dot_config/home-manager/config/vscode_plugins.nix'
      - uses: EndBug/add-and-commit@v9
        with:
          author_name: bot
          author_email: [email protected]
          commit: --signoff
          message: "feat(vscode): Update vscode extension"

@hydrajump
Copy link
Author

Thank you for sharing! The only thing I need to do manually is make sure that the vscode_version in config.toml is the same as the installed version.

@cathaysia cathaysia pinned this issue Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants