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

chore: add a release and deploy Github Action #7385

Merged
merged 2 commits into from
Aug 23, 2021
Merged

chore: add a release and deploy Github Action #7385

merged 2 commits into from
Aug 23, 2021

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Aug 18, 2021

The release job will do an npm publish and a github-release.
It's based on videojs/.github/github-release.yml.
The new version is published as next and requires to be promoted to
latest manually.

The deploy job, should do an aws s3 sync to upload the files to S3 for
us. It uses a Github Environment secrets. This is so that we can require
a user to approve the CDN upload.

The release job will do an npm publish and a github-release.
It's based on videojs/.github/github-release.yml.
The new version is published as `next` and requires to be promoted to
latest manually.

The deploy job, should do an aws s3 sync to upload the files to S3 for
us. It uses a Github Environment secrets. This is so that we can require
a user to approve the CDN upload.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: get current changelog
run: node -e "console.log(require('./build/current-changelog.js')())" > CHANGELOG-LATEST.md
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to continue using what we have locally for now until we deprecate releasing locally with the gh-release or update it to use the same thing that's in videojs/.github/github-release.yml

Comment on lines +37 to +41
# publish runs build for us via a prepublishOnly script
- name: npm release
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add this to VHS too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I could see benefits to us publishing in ci, perhaps we even make the build depend upon the ci integration passing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, though, I think making it happen on a tag is fine. It means user-intervention is required for publishing.

@codecov
Copy link

codecov bot commented Aug 18, 2021

Codecov Report

Merging #7385 (bcab766) into main (9e82035) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7385   +/-   ##
=======================================
  Coverage   79.72%   79.72%           
=======================================
  Files         116      116           
  Lines        7295     7295           
  Branches     1753     1753           
=======================================
  Hits         5816     5816           
  Misses       1479     1479           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e82035...bcab766. Read the comment docs.


# publish runs build for us via a prepublishOnly script
- name: npm release
run: npm publish --tag next
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always want to publish to the next tag by default and then later on someone can manually upgrade the version.


- name: Copy files to the CDN with the AWS CLI
run: |
aws s3 sync node_modules/video.js/dist/ s3://${S3_KEY}/${VJS_VERSION}/ --acl ${S3_ACCESS}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should upload to a full version specific folder, i.e. 7.15.0/video.js. I may create a promote workflow that can set the npm tag to latest and also upload it to s3 under the minor, i.e. 7.15/video.js (and maybe major too, i.e. 7/video.js).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this should work, I wasn't able to test it directly, so, our first release with this will likely be also our test. I was able to test the gh and npm release in a test project and those worked flawlessly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new task would be cool, because we could potentially automate updating the GH Release to no longer be a pre-release either.

runs-on: ubuntu-latest
environment: Deploy
env:
VJS_VERSION: ${{ github.event.head_commit.message }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have it set up so that the commit message here is the full version of Video.js without any preceding v, so, we can use it directly as the VJS_VERSION.

deploy:
needs: release
runs-on: ubuntu-latest
environment: Deploy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env is what makes the AWS secrets available. It also requires a manual approval from me before it'll run.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want deploy to run on semver prereleases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't previously, but I don't see an issue with doing so. We also haven't done semver pre-releases in Video.js in a long time.

token: ${{github.token}}
prerelease: true
files: dist/*.zip
discussion_category_name: Releases
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a discussion from the release under the Releases category.

@gkatsev gkatsev added the needs: LGTM Needs one or more additional approvals label Aug 19, 2021
@gkatsev gkatsev merged commit 957c6fa into main Aug 23, 2021
@gkatsev gkatsev deleted the release-on-tag branch August 23, 2021 19:30
@gkatsev gkatsev removed the needs: LGTM Needs one or more additional approvals label Aug 23, 2021
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
The release job will do an npm publish and a github-release.
It's based on videojs/.github/github-release.yml.
The new version is published as `next` and requires to be promoted to
latest manually.

The deploy job, should do an aws s3 sync to upload the files to S3 for
us. It uses a Github Environment secrets. This is so that we can require
a user to approve the CDN upload.
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

Successfully merging this pull request may close these issues.

2 participants