diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..000d73e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/scripts/publish.sh b/.github/scripts/publish.sh new file mode 100755 index 0000000..8ca000d --- /dev/null +++ b/.github/scripts/publish.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# npm publish with goodies +# inspired by https://gist.github.com/stevemao/280ef22ee861323993a0 +# +# prerequisites: +# `npm install -D conventional-recommended-bump \ +# conventional-changelog-cli conventional-github-releaser` +# `release` with optional argument `patch`/`minor`/`major`/`` +# defaults to conventional-recommended-bump + +# `np` is not suitable for CI/CD +# https://github.com/sindresorhus/np/issues/619#issuecomment-994493179 + +release() { + BUMP=$(npx -p conventional-changelog-angular -p conventional-recommended-bump -c 'conventional-recommended-bump -p angular') + VERSION=$(npm --no-git-tag-version version ${1:-$BUMP}) + npx conventional-changelog-cli -p angular -i CHANGELOG.md -s + git add CHANGELOG.md + git commit -m "docs(CHANGELOG): $VERSION" + npm --force --allow-same-version version $VERSION -m "chore(release): %s" + git push --follow-tags + npx conventional-github-releaser -p angular + npm publish --access public +}; + +canary() { + # get last published version from NPM without alpha / beta, remove -SHA hash + LAST_VERSION=$(npm view vimeo-video-element versions --json | + jq -r '. - map(select(contains("alpha") or contains("beta"))) | last' | + sed -r 's/-[a-z0-9]{7}$//g') + PRE_VERSION=$(npx semver $LAST_VERSION -i prerelease --preid canary) + VERSION=$PRE_VERSION-$(git rev-parse --short HEAD) + npm --no-git-tag-version version $VERSION + npm publish --tag canary +} diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..7ebf754 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,47 @@ +name: CD + +concurrency: production + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + inputs: + version_type: + type: choice + required: true + description: Version + options: + - conventional + - patch + - minor + - major + +jobs: + deploy: + runs-on: ubuntu-latest + environment: production + + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all history for all tags and branches + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + # this line is required for the setup-node action to be able to run the npm publish below. + registry-url: 'https://registry.npmjs.org' + - uses: fregante/setup-git-user@v1 + - run: npm ci + - run: npm test + - run: npm run build + - run: . ./.github/scripts/publish.sh; release ${{ inputs.version_type }} + if: ${{ inputs.version_type != 'conventional' }} + shell: bash + - run: . ./.github/scripts/publish.sh; release + if: ${{ inputs.version_type == 'conventional' }} + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed1435d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - run: npm ci + - run: npm run build + - run: npm test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9349ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/dist/ +/node_modules/ +/.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c74bea1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Wesley Luyten + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ada5c2f --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# `` + +A custom element (web component) for Vimeo. + +The element API matches the HTML5 `