2020-04-28 02:32:19 +00:00
|
|
|
name: Nightly builds
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *' # Run at 12 AM UTC.
|
2022-05-17 19:29:16 +00:00
|
|
|
workflow_dispatch:
|
2023-01-02 17:28:11 +00:00
|
|
|
|
2024-09-16 09:11:15 +00:00
|
|
|
env:
|
|
|
|
SOURCE_REF: trunk
|
|
|
|
TARGET_REF: nightly
|
|
|
|
RELEASE_ID: 25945111
|
|
|
|
|
|
|
|
permissions: { }
|
2023-01-02 17:28:11 +00:00
|
|
|
|
2020-04-28 02:32:19 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
2021-03-16 00:44:01 +00:00
|
|
|
if: github.repository_owner == 'woocommerce'
|
2020-04-28 02:32:19 +00:00
|
|
|
name: Nightly builds
|
2024-09-16 09:11:15 +00:00
|
|
|
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2023-01-02 17:28:11 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2020-04-28 02:32:19 +00:00
|
|
|
steps:
|
2024-09-16 09:11:15 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-04-28 02:32:19 +00:00
|
|
|
with:
|
2024-09-16 09:11:15 +00:00
|
|
|
ref: ${{ env.SOURCE_REF }}
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-09-13 01:55:03 +00:00
|
|
|
- name: Setup WooCommerce Monorepo
|
|
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
2024-07-10 12:39:49 +00:00
|
|
|
with:
|
|
|
|
pull-package-deps: '@woocommerce/plugin-woocommerce'
|
2022-05-02 23:48:20 +00:00
|
|
|
|
2022-04-27 13:40:37 +00:00
|
|
|
- name: Build zip
|
2022-05-02 23:48:20 +00:00
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: bash bin/build-zip.sh
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2024-09-16 09:11:15 +00:00
|
|
|
- name: Upload nightly build
|
|
|
|
uses: WebFreak001/deploy-nightly@46ecbabd7fad70d3e7d2c97fe8cd54e7a52e215b #v3.2.0
|
2020-04-28 02:32:19 +00:00
|
|
|
with:
|
2024-09-16 09:11:15 +00:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}/assets{?name,label}
|
|
|
|
release_id: ${{ env.RELEASE_ID }}
|
2022-04-27 13:40:37 +00:00
|
|
|
asset_path: plugins/woocommerce/woocommerce.zip
|
2024-09-16 09:11:15 +00:00
|
|
|
asset_name: woocommerce-${{ env.SOURCE_REF }}-nightly.zip
|
2020-04-28 02:32:19 +00:00
|
|
|
asset_content_type: application/zip
|
|
|
|
max_releases: 1
|
2024-09-16 09:11:15 +00:00
|
|
|
|
|
|
|
- name: Update nightly tag commit ref
|
|
|
|
uses: actions/github-script@v7
|
2020-04-28 02:32:19 +00:00
|
|
|
with:
|
2024-09-16 09:11:15 +00:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
const sourceRef = process.env.SOURCE_REF;
|
|
|
|
const targetRef = process.env.TARGET_REF;
|
|
|
|
const branchData = await github.rest.repos.getBranch({
|
|
|
|
...context.repo,
|
|
|
|
branch: sourceRef,
|
|
|
|
});
|
|
|
|
|
|
|
|
await github.rest.git.updateRef({
|
|
|
|
...context.repo,
|
|
|
|
ref: `tags/${ targetRef }`,
|
|
|
|
sha: branchData.data.commit.sha,
|
|
|
|
});
|