diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 0000000..44f4ee1 --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,105 @@ +name: Deploy Bundle to Dev + +on: + push: + branches: [master] + +jobs: + build-release: + runs-on: ${{ matrix.os }} + permissions: + id-token: write + contents: read + actions: read + environment: DEV + strategy: + matrix: + node: ["20.x"] + os: [ubuntu-latest] + env: + CI: 1 + HUSKY: 0 # disables husky hooks + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_SEMANTIC_RELEASE_PAT }} + + - name: Use Node ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + # registry-url not needed - no npm publishing in dev workflow + + - name: Install Deps (with cache) + uses: bahmutov/npm-install@v1 + with: + install-command: yarn --immutable --no-progress --ignore-scripts + + - name: Get New Version + id: get-new-version + uses: mathieudutour/github-tag-action@v5.2 + with: + dry_run: true + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Bump Version + run: make update-version NEW_VERSION=${{ steps.get-new-version.outputs.new_version }} + + - name: Build + run: make build + env: + SKIP_INSTALL: 1 # install with cache was done already + + create-pre-release: + runs-on: ubuntu-latest + needs: + - build-release + strategy: + matrix: + node: ["20.x"] + steps: + - name: Version and Tag + id: version-and-tag + uses: mathieudutour/github-tag-action@v5.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate Release Notes + id: release-notes + uses: actions/github-script@v6 + env: + NEW_RELEASE_TAG: ${{ steps.version-and-tag.outputs.new_tag }} + with: + result-encoding: string + script: | + const { NEW_RELEASE_TAG } = process.env; + const latestRelease = await github.rest.repos.getLatestRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + const releaseNotes = await github.rest.repos.generateReleaseNotes({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: NEW_RELEASE_TAG, + previous_tag_name: latestRelease.data.tag_name, + }); + return releaseNotes.data.body; + + - name: Create Pre-Release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + generate_release_notes: false + body: ${{ steps.release-notes.outputs.result }} + tag_name: ${{ steps.version-and-tag.outputs.new_tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Stop Deploy Message + if: always() + uses: Basis-Theory/github-actions/deploy-slack-action@master + with: + slack-api-token: ${{ secrets.SLACK_DUCKBOT_API_KEY }} + channel: ${{ vars.SLACK_DUCKBOT_DEV_DEPLOY_CHANNEL_ID }} + status: "done" diff --git a/package.json b/package.json index b6cc634..0bff035 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "name": "@basis-theory/react-native-elements", "version": "0.0.0", + "repository": { + "type": "git", + "url": "https://github.com/Basis-Theory/react-native-elements" + }, "scripts": { "android": "react-native run-android", "build": "bob build && node prepare.js", diff --git a/scripts/updateversion.sh b/scripts/updateversion.sh index b8f3ea4..540f4aa 100755 --- a/scripts/updateversion.sh +++ b/scripts/updateversion.sh @@ -3,10 +3,10 @@ set -e current_directory="$PWD" -cd $(dirname $0) +cd $(dirname $0)/.. echo "Bumping to version ${NEW_VERSION}" -jq --arg v "$NEW_VERSION" '.version = $v' ../package.json > ../package.json.tmp && mv ../package.json.tmp ../package.json +jq --arg v "$NEW_VERSION" '.version = $v' package.json > package.json.tmp && mv package.json.tmp package.json cd "$current_directory"