name: self-hosted on: push: branches: - master - releases/** pull_request: # Cancel in progress workflows on pull_requests. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359 env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 NODE_OPTIONS: '--max-old-space-size=4096' jobs: self-hosted: runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - uses: getsentry/action-setup-volta@c52be2ea13cfdc084edb806e81958c13e445941e # v1.2.0 - name: Step configurations id: config run: | echo "webpack-path=.webpack_cache" >> "$GITHUB_OUTPUT" echo "WEBPACK_CACHE_PATH=.webpack_cache" >> "$GITHUB_ENV" - name: webpack cache uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 with: path: ${{ steps.config.outputs.webpack-path }} key: ${{ runner.os }}-self-hosted-webpack-cache-${{ hashFiles('webpack.config.ts') }} - name: node_modules cache uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 id: nodemodulescache with: path: node_modules key: ${{ runner.os }}-self-hosted-node-modules-${{ hashFiles('yarn.lock') }} - name: Install Javascript Dependencies if: steps.nodemodulescache.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile --production - run: | python setup.py bdist_wheel --build-number 0 cp requirements-frozen.txt dist/ - run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN" env: GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: github.event_name != 'pull_request' - run: docker buildx create --driver docker-container --use - run: | if [ ${{ github.event_name }} = 'push' ]; then args=( --tag ghcr.io/getsentry/sentry-self-hosted:latest --push ) else args=() fi docker buildx build \ --pull \ --cache-from ghcr.io/getsentry/sentry-self-hosted:latest \ --cache-to type=inline \ --tag ghcr.io/getsentry/sentry-self-hosted:${{ github.sha }} \ --file self-hosted/Dockerfile \ --build-arg SOURCE_COMMIt=${{ github.sha }} \ "${args[@]}" \ .