name: Publish Snapshot

on:
  schedule:
  - cron: '0 0 * * *'

jobs:
  publish-snapshot:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Spark repository
      uses: actions/checkout@master
    - name: Cache Maven local repository
      uses: actions/cache@v2
      with:
        path: ~/.m2/repository
        key: snapshot-maven-${{ hashFiles('**/pom.xml') }}
        restore-keys: |
          snapshot-maven-
    - name: Install Java 8
      uses: actions/setup-java@v1
      with:
        java-version: 8
    - name: Publish snapshot
      env:
        ASF_USERNAME: ${{ secrets.NEXUS_USER }}
        ASF_PASSWORD: ${{ secrets.NEXUS_PW }}
        GPG_KEY: "not_used"
        GPG_PASSPHRASE: "not_used"
      run: ./dev/create-release/release-build.sh publish-snapshot

Add GitHub Action job to publish snapshot
[SPARK-33675][INFRA] Add GitHub Action job to publish snapshot

### What changes were proposed in this pull request?

This PR aims to add `GitHub Action` job to publish daily snapshot for **master** branch.
- https://repository.apache.org/content/groups/snapshots/org/apache/spark/spark-core_2.12/3.2.0-SNAPSHOT/

For the other branches, I'll make adjusted backports.
- For `branch-3.1`, we can specify the checkout `ref` to `branch-3.1`.
- For `branch-2.4` and `branch-3.0`, we can publish at every commit since the traffic is low.
  - https://github.com/apache/spark/pull/30630 (branch-3.0)
  - https://github.com/apache/spark/pull/30629 (branch-2.4 LTS)

### Why are the changes needed?

After this series of jobs, this will reduce our maintenance burden permanently from AmpLab Jenkins by removing the following completely.

https://amplab.cs.berkeley.edu/jenkins/view/Spark%20Packaging/

For now, AmpLab Jenkins doesn't have a job for `branch-3.1`. We can do it by ourselves by `GitHub Action`.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

The snapshot publishing is tested here at PR trigger. Since this PR adds a scheduled job, we cannot test in this PR.
- https://github.com/dongjoon-hyun/spark/runs/1505792859

Apache Infra team finished the setup here.
- https://issues.apache.org/jira/browse/INFRA-21167

Closes #30623 from dongjoon-hyun/SPARK-33675.

Authored-by: Dongjoon Hyun <6ff48b33cbb828151035af58a92f18a39f1d1036@apache.org>
Signed-off-by: HyukjinKwon <2680965ad5aae29275c8fb10150cb10f5554e78b@apache.org>
