-
Notifications
You must be signed in to change notification settings - Fork 41
84 lines (72 loc) · 2.86 KB
/
publish-eap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Publish zio-intellij to eap release channel
on:
workflow_dispatch:
schedule:
# run every day at midnight UTC±00:00
- cron: "0 0 * * *"
jobs:
fetch-commit-hashes:
runs-on: ubuntu-latest
outputs:
latest-commit: ${{ steps.fetch-latest-commits.outputs.latest-commit }}
latest-tagged-commit: ${{ steps.fetch-latest-commits.outputs.latest-tagged-commit }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# 0 indicates all history for all branches and tags.
fetch-depth: 0
- name: Branch name
uses: nelonoel/[email protected]
- name: Fetch latest commits
id: fetch-latest-commits
run: |
commit_tag="eap-${BRANCH_NAME}"
echo "::set-output name=latest-commit::$(git log -n 1 --format=format:%H ${BRANCH_NAME})"
echo "::set-output name=latest-tagged-commit::$(git rev-list -n 1 ${commit_tag})"
- name: Print latest commits
run: |
echo "latest-commit: ${{ steps.fetch-latest-commits.outputs.latest-commit }}"
echo "latest-tagged-commit: ${{ steps.fetch-latest-commits.outputs.latest-tagged-commit }}"
publish:
needs:
- fetch-commit-hashes
runs-on: ubuntu-latest
if: needs.fetch-commit-hashes.outputs.latest-commit != needs.fetch-commit-hashes.outputs.latest-tagged-commit
env:
ZIO_INTELLIJ_BUILD_NUMBER: ${{ github.run_number }}
ZIO_INTELLIJ_CHANGE_NOTES: "—"
IJ_PLUGIN_REPO_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Scala
uses: olafurpg/setup-scala@v14
with:
java-version: "[email protected]"
- name: Package plugin
# The first packageArtifact creates the files (including plugin.xml).
# The second packageArtifactZip allows the patchPluginXML task to run
# on those files and patch the plugin.xml.
# Then it packages files into a single zip archive.
run: sbt clean && sbt packageArtifact && sbt packageArtifactZip
- name: Publish plugin
run: sbt "publishPlugin EAP"
tag-latest-commit:
needs:
- publish
- fetch-commit-hashes
runs-on: ubuntu-latest
if: needs.fetch-commit-hashes.outputs.latest-commit != needs.fetch-commit-hashes.outputs.latest-tagged-commit
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Branch name
uses: nelonoel/[email protected]
- name: Update tag
run: |
commit_tag="eap-${BRANCH_NAME}"
git tag -d ${commit_tag} 2> /dev/null || true
git tag ${commit_tag} ${{ needs.fetch-commit-hashes.outputs.latest-commit }}
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git push ${remote_repo} ${commit_tag} -f