优化
This commit is contained in:
@@ -183,38 +183,11 @@ jobs:
|
|||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
- name: Create or update beta tag
|
- name: Create or update beta tag
|
||||||
uses: actions/github-script@v7
|
uses: richardsimko/update-tag@v1
|
||||||
with:
|
with:
|
||||||
script: |
|
tag_name: beta
|
||||||
const createReleaseTag = async (client, refInfo) => {
|
env:
|
||||||
core.startGroup('Generating release tag');
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
const friendlyTagName = refInfo.ref.substring(10); // 'refs/tags/latest' => 'latest'
|
|
||||||
core.info(`Attempting to create or update release tag "${friendlyTagName}"`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await client.git.createRef(refInfo);
|
|
||||||
} catch (err) {
|
|
||||||
const existingTag = refInfo.ref.substring(5); // 'refs/tags/latest' => 'tags/latest'
|
|
||||||
core.info(
|
|
||||||
`Could not create new tag "${refInfo.ref}" (${err.message}) therefore updating existing tag "${existingTag}"`,
|
|
||||||
);
|
|
||||||
await client.git.updateRef({
|
|
||||||
...refInfo,
|
|
||||||
ref: existingTag,
|
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`Successfully created or updated the release tag "${friendlyTagName}"`);
|
|
||||||
core.endGroup();
|
|
||||||
};
|
|
||||||
|
|
||||||
await createReleaseTag(github.rest, {
|
|
||||||
owner: context.repo.owner,
|
|
||||||
ref: 'refs/tags/beta',
|
|
||||||
repo: context.repo.repo,
|
|
||||||
sha: context.sha,
|
|
||||||
});
|
|
||||||
|
|
||||||
- name: Publish Pre-Release
|
- name: Publish Pre-Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
|
|||||||
Reference in New Issue
Block a user