diff --git a/.github/workflows/copy-build-to-d2-ci.yml b/.github/workflows/copy-build-to-d2-ci.yml index 808edf0c8..13bc2d8bb 100644 --- a/.github/workflows/copy-build-to-d2-ci.yml +++ b/.github/workflows/copy-build-to-d2-ci.yml @@ -1,83 +1,42 @@ -name: Publish JavaScript Library +name: Copy build to d2-ci on: - push: - branches-ignore: - - master - release: - types: [published] + push: + branches-ignore: + - master env: - GIT_AUTHOR_NAME: '@dhis2-bot' - GIT_AUTHOR_EMAIL: 'apps@dhis2.org' - GIT_COMMITTER_NAME: '@dhis2-bot' - GIT_COMMITTER_EMAIL: 'apps@dhis2.org' - NPM_TOKEN: ${{secrets.DHIS2_BOT_NPM_TOKEN}} - GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} + GIT_AUTHOR_NAME: '@dhis2-bot' + GIT_AUTHOR_EMAIL: 'apps@dhis2.org' + GIT_COMMITTER_NAME: '@dhis2-bot' + GIT_COMMITTER_EMAIL: 'apps@dhis2.org' + NPM_TOKEN: ${{secrets.DHIS2_BOT_NPM_TOKEN}} + GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} jobs: - publish-to-github: - runs-on: ubuntu-latest - if: contains(github.ref, 'alpha') - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - token: ${{env.GH_TOKEN}} - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install dependencies - run: npm install --frozen-lockfile - - - name: Build package - run: yarn build - - - name: Pack and unpack the build - run: yarn pack --filename output.tgz && tar -xzf output.tgz - - - name: Copy package to d2-ci - uses: dhis2/deploy-build@master - with: - github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }} - - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_CONFIG_REGISTRY: https://npm.pkg.github.com/ - - - - - - - - - - - publish-to-npm: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install dependencies - run: npm install - - - name: Build package - run: npm run build - - - name: Publish to npm - run: npm publish --registry=https://registry.npmjs.org - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + copy-to-d2-ci: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{env.GH_TOKEN}} + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm install --frozen-lockfile + + - name: Build package + run: yarn build + + - name: Pack and unpack the build + run: yarn pack --filename output.tgz && tar -xzf output.tgz + + - name: Copy package to d2-ci + uses: dhis2/deploy-build@master + with: + github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}