mirror of
https://github.com/VSCodium/vscodium.git
synced 2024-12-23 17:04:12 +03:00
feat: automate winget release (#1260)
This commit is contained in:
parent
a65ecfc37b
commit
03be08e721
7
.github/workflows/insider-linux.yml
vendored
7
.github/workflows/insider-linux.yml
vendored
@ -18,7 +18,7 @@ on:
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ matrix.image }}
|
||||
@ -113,8 +113,7 @@ jobs:
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
snap:
|
||||
if: ${{ false }}
|
||||
needs: release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VSCODE_QUALITY: 'insider'
|
||||
@ -124,6 +123,8 @@ jobs:
|
||||
platform:
|
||||
- amd64
|
||||
- arm64
|
||||
# if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
|
||||
if: ${{ false }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
30
.github/workflows/insider-windows.yml
vendored
30
.github/workflows/insider-windows.yml
vendored
@ -18,7 +18,7 @@ on:
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
@ -104,8 +104,34 @@ jobs:
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
- name: Update versions repo
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
run: ./update_version.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
|
||||
GITHUB_USERNAME: ${{ github.repository_owner }}
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
winget:
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
VSCODE_QUALITY: 'insider'
|
||||
if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: insider
|
||||
|
||||
- name: Check version
|
||||
run: ./stores/winget/check_version.sh
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
|
||||
|
||||
- name: Release to WinGet
|
||||
uses: vedantmgoyal2009/winget-releaser@latest
|
||||
with:
|
||||
identifier: VSCodium.VSCodium.Insiders
|
||||
release-tag: ${{ env.RELEASE_VERSION }}
|
||||
installers-regex: '\.exe$' # only .exe files
|
||||
token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
|
||||
if: env.SHOULD_DEPLOY == 'yes'
|
||||
|
5
.github/workflows/stable-linux.yml
vendored
5
.github/workflows/stable-linux.yml
vendored
@ -18,7 +18,7 @@ on:
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ matrix.image }}
|
||||
@ -111,7 +111,7 @@ jobs:
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
snap:
|
||||
needs: release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -119,6 +119,7 @@ jobs:
|
||||
platform:
|
||||
- amd64
|
||||
- arm64
|
||||
if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
40
.github/workflows/stable-windows.yml
vendored
40
.github/workflows/stable-windows.yml
vendored
@ -18,7 +18,7 @@ on:
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
@ -101,26 +101,30 @@ jobs:
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
- name: Update versions repo
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
run: ./update_version.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
|
||||
GITHUB_USERNAME: ${{ github.repository_owner }}
|
||||
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
# - name: Set MS_TAG as job output for release-winget job
|
||||
# if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
# run: echo "::set-output name=tagname::${{ env.MS_TAG }}"
|
||||
winget:
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
# release-winget:
|
||||
# name: Release to WinGet
|
||||
# needs: windows
|
||||
# if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
|
||||
# runs-on: windows-latest # action can only be run on windows
|
||||
# steps:
|
||||
# - name: Release to WinGet
|
||||
# uses: vedantmgoyal2009/winget-releaser@latest
|
||||
# with:
|
||||
# identifier: VSCodium.VSCodium
|
||||
# release-tag: ${{ needs.windows.outputs.tagname }}
|
||||
# installers-regex: '\.exe$' # only .exe files
|
||||
# token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Check version
|
||||
run: ./stores/winget/check_version.sh
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
|
||||
|
||||
- name: Release to WinGet
|
||||
uses: vedantmgoyal2009/winget-releaser@latest
|
||||
with:
|
||||
identifier: VSCodium.VSCodium.Insiders
|
||||
release-tag: ${{ env.RELEASE_VERSION }}
|
||||
installers-regex: '\.exe$' # only .exe files
|
||||
token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
|
||||
if: env.SHOULD_DEPLOY == 'yes'
|
||||
|
@ -25,4 +25,6 @@ fi
|
||||
if [[ "${GITHUB_ENV}" ]]; then
|
||||
echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}"
|
||||
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
|
||||
|
||||
echo "::set-output name=SHOULD_DEPLOY::${SHOULD_DEPLOY}"
|
||||
fi
|
||||
|
@ -107,6 +107,8 @@ if [[ ${GITHUB_ENV} ]]; then
|
||||
echo "MS_TAG=${MS_TAG}" >> "${GITHUB_ENV}"
|
||||
echo "MS_COMMIT=${MS_COMMIT}" >> "${GITHUB_ENV}"
|
||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}"
|
||||
|
||||
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
|
||||
fi
|
||||
|
||||
. version.sh
|
||||
|
@ -2,46 +2,34 @@
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
|
||||
echo "It's a PR"
|
||||
|
||||
export SHOULD_DEPLOY="no"
|
||||
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
|
||||
echo "It's a Push"
|
||||
|
||||
export SHOULD_DEPLOY="no"
|
||||
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
|
||||
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}-insiders"
|
||||
SNAP_NAME="codium-insiders"
|
||||
else
|
||||
echo "It's a cron"
|
||||
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
|
||||
SNAP_NAME="codium"
|
||||
fi
|
||||
|
||||
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
|
||||
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}-insiders"
|
||||
SNAP_NAME="codium-insiders"
|
||||
else
|
||||
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
|
||||
SNAP_NAME="codium"
|
||||
fi
|
||||
sudo snap install --channel stable --classic snapcraft
|
||||
|
||||
sudo snap install --channel stable --classic snapcraft
|
||||
echo "Architecture: ${ARCHITECTURE}"
|
||||
|
||||
echo "Architecture: ${ARCHITECTURE}"
|
||||
SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
|
||||
echo "Snap version: ${SNAP_VERSION}"
|
||||
|
||||
SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
|
||||
echo "Snap version: ${SNAP_VERSION}"
|
||||
wget --quiet "https://api.github.com/repos/${REPOSITORY}/releases" -O gh_latest.json
|
||||
GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
|
||||
echo "GH version: ${GH_VERSION}"
|
||||
|
||||
wget --quiet "https://api.github.com/repos/${REPOSITORY}/releases" -O gh_latest.json
|
||||
GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json)
|
||||
echo "GH version: ${GH_VERSION}"
|
||||
rm -f gh_latest.json
|
||||
|
||||
rm -f gh_latest.json
|
||||
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
|
||||
export SHOULD_DEPLOY="no"
|
||||
else
|
||||
export SHOULD_DEPLOY="yes"
|
||||
|
||||
if [[ "${SNAP_VERSION}" == "${GH_VERSION}" ]]; then
|
||||
export SHOULD_DEPLOY="no"
|
||||
else
|
||||
export SHOULD_DEPLOY="yes"
|
||||
|
||||
snap version
|
||||
snap info "${SNAP_NAME}" | true
|
||||
fi
|
||||
snap version
|
||||
snap info "${SNAP_NAME}" | true
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_ENV}" ]]; then
|
||||
|
27
stores/winget/check_version.sh
Executable file
27
stores/winget/check_version.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
|
||||
VERSIONS=$( curl --silent https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/v/VSCodium/VSCodium/Insiders )
|
||||
|
||||
RELEASE_VERSION="${RELEASE_VERSION/\-insider/}"
|
||||
else
|
||||
VERSIONS=$( curl --silent https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/v/VSCodium/VSCodium )
|
||||
fi
|
||||
|
||||
WINGET_VERSION=$( echo "${VERSIONS}" | jq -r 'map(.name) | last' )
|
||||
|
||||
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\""
|
||||
echo "WINGET_VERSION=\"${WINGET_VERSION}\""
|
||||
|
||||
if [[ "${RELEASE_VERSION}" == "${WINGET_VERSION}" ]]; then
|
||||
export SHOULD_DEPLOY="no"
|
||||
else
|
||||
export SHOULD_DEPLOY="yes"
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_ENV}" ]]; then
|
||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}"
|
||||
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user