Skip to content

Fix issue with npm publish workflows #4790

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

Closed
4 tasks
jsjoeio opened this issue Jan 25, 2022 · 1 comment · Fixed by #4797
Closed
4 tasks

Fix issue with npm publish workflows #4790

jsjoeio opened this issue Jan 25, 2022 · 1 comment · Fixed by #4797
Assignees
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP
Milestone

Comments

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 25, 2022

@code-asher pointed out a bug with our npm publish. Based on the way download_artifact works in our lib.sh script, it always grabs the binary based on the latest release branch (i.e. v4.0.1). This means we've been publishing PR builds and beta builds using the same binary as latest 🤦‍♂️

Solution

We're going to fix this by moving the workflows into one job and moving the switch logic into the bash script. We arrived at this decision because it's the best solution given the way download_artifact works and how we utilize GitHub artifacts.

TODOs

  • combine npm workflows into one job in ci.yaml
  • add logic to bash script publish-npm to check which values to use based on environment variables in job
  • modify download_artifact to take an argument
  • make diagram that shows each of the different scenarios ("staging", "dev" and "production")

Resources

Notes

ENVIRONMENT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && "production" || "staging" }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
GITHUB_EVENT_NAME
GITHUB_REF

Read here for default envs: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

@jsjoeio jsjoeio added the bug Something isn't working label Jan 25, 2022
@jsjoeio jsjoeio added this to the 4.0.2 milestone Jan 25, 2022
@jsjoeio jsjoeio self-assigned this Jan 25, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Jan 25, 2022

@code-asher caught another bug. The current workflow assumes NPM_TOKEN defined. It is defined as a repo secret, but this isn't available to forks.

image

To fix this we need to generate a new token and add to the environment npm as a secret.

After adding secret test with:

  1. fork code-server
  2. open PR
  3. approve workflow

Expected: it should have access to that secret and successfully publish on npm.

@code-asher code-asher modified the milestones: 4.0.2, 4.0.3 Jan 27, 2022
@jsjoeio jsjoeio added the high-priority This issue needs to be resolved ASAP label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants