Skip to content

Update

Update #35837

Workflow file for this run

name: Update
on:
push:
branches:
- main
paths:
- .github/workflows/**
- .github/actions/**
- PKGBUILD
- visual-studio-code-insiders.desktop
- visual-studio-code-insiders-url-handler.desktop
- visual-studio-code-insiders.sh
workflow_dispatch:
schedule:
- cron: "0 */1 * * *"
jobs:
get-upstream-version:
name: Get upstream version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
build_number: ${{ steps.get-build-number.outputs.build_number }}
sha256-x86_64: ${{ steps.sha256-x86_64.outputs.hash }}
steps:
- uses: actions/checkout@v2
- name: Download latest tar
run: curl -JLO "$(cat PKGBUILD | grep -Po "_src_x86_64=\"\K.+\"" | rev | cut -c2- | rev)"
- name: Get build number
id: get-build-number
run: |
build_number="$(echo ./code-insider-*.tar.gz | grep -Po "\.\/code-insider-x64-\K.+" | rev | cut -c8- | rev)"
echo "build_number=${build_number}" >> $GITHUB_OUTPUT
echo "Latest build number: ${build_number}"
- name: Extract tar
run: tar -xvzf ./code-insider-*.tar.gz
- name: Get version
id: get-version
run: |
version="$(./VSCode-linux-x64/bin/code-insiders --version | head -n1 | sed "s/-/_/")"
echo "version=${version}" >> $GITHUB_OUTPUT
echo "Latest version: ${version}"
- name: Get SHA256 of x86_64 tar
id: sha256-x86_64
run: |
hash="$(sha256sum ./code-insider-*.tar.gz | awk '{ print $1 }')"
echo "hash=${hash}" >> $GITHUB_OUTPUT
echo "SHA256 x86_64: ${hash}"
edit-pkgbuild:
needs: get-upstream-version
name: Edit PKGBUILD and push
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.bump-version.outputs.updated }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Update version
id: bump-version
env:
INPUT_BUILD_NUMBER: ${{ needs.get-upstream-version.outputs.build_number }}
INPUT_VERSION: ${{ needs.get-upstream-version.outputs.version }}
INPUT_SHA256_x86_64: ${{ needs.get-upstream-version.outputs.sha256-x86_64 }}
run: python ./.github/actions/update-version/update-version.py
- name: Build package and update .SRCINFO
id: pkg
uses: ./.github/actions/pkg
- name: Upload pkg artefact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.pkg.outputs.pkgfile }}
path: ${{ steps.pkg.outputs.pkgfile }}
- name: Upload PKGBUILD artefact
uses: actions/upload-artifact@v4
with:
name: PKGBUILD
path: PKGBUILD
- name: Upload .SRCINFO artefact
uses: actions/upload-artifact@v4
with:
name: .SRCINFO
path: .SRCINFO
include-hidden-files: true
build-github-pages:
name: Build GitHub Pages
needs: edit-pkgbuild
runs-on: ubuntu-latest
container: archlinux
if: needs.edit-pkgbuild.outputs.updated == 'true' || github.event_name != 'schedule'
steps:
- name: Install dependencies and update
run: pacman -Syu --noconfirm --noprogressbar --needed base-devel git
- name: Download artefacts
uses: actions/download-artifact@v4
with:
path: pkg/
- name: Create repo files
run: |
mkdir dist/
mv pkg/*/*.pkg.* dist
repo-add -R dist/visual-studio-code-insiders.db.tar.gz dist/visual-studio-code-insiders-*.pkg.*
- uses: actions/checkout@v2
with:
path: repo/
- name: Generate index
run: repo/.github/actions/generate-index/generate-index.sh dist
- name: Configure Git to reduce push errors
run: |
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
user_name: 'github-actions[bot]'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
commit_message: Deploy commit
force_orphan: true
update-pkgbuild:
name: Update PKGBUILD
# Only run if there was a PKGBUILD update
# Only update if deploy was successful so failed deploys are retried
needs: [get-upstream-version, edit-pkgbuild, build-github-pages]
# In case this isn't a scheduled run
if: needs.edit-pkgbuild.outputs.updated == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download PKGBUILD artefact
uses: actions/download-artifact@v4
with:
name: PKGBUILD
- name: Download .SRCINFO artefact
uses: actions/download-artifact@v4
with:
name: .SRCINFO
- name: Push update
env:
INPUT_BUILD_NUMBER: ${{ needs.get-upstream-version.outputs.build_number }}
INPUT_VERSION: ${{ needs.get-upstream-version.outputs.version }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add PKGBUILD .SRCINFO
git commit -m "Update to ${INPUT_VERSION}+${INPUT_BUILD_NUMBER}"
git push