Skip to content

Commit

Permalink
Enable prereleases and replacing release text across files (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Aug 26, 2020
1 parent 6c3d810 commit 768cfe7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 12 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/deploy.yml
Expand Up @@ -12,35 +12,58 @@ jobs:
name: Deploy Docker images
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Output Docker info
run: docker info
- name: Sets build date
run: echo ::set-env name=BUILD_DATE::$(date '+%Y%m%d')
- name: Sets prerelease to false by default
run: echo ::set-env name=PRERELEASE::false
- name: Build base image to get Grid version
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base
- name: Get Grid version
# sed used to remove last comma of Selenium version output
run: echo ::set-env name=GRID_VERSION::$(docker run --rm selenium/base:local-${BUILD_DATE} java -jar /opt/selenium/selenium-server.jar hub --version | awk '{print $3}' | sed 's/\(.*\),/\1 /')
- name: Is it a prerelease?
run: echo ::set-env name=GRID_VERSION::${GRID_VERSION}-prerelease && echo ::set-env name=PRERELEASE::true
if: contains(toJson(github.event.commits), '[prerelease]') == true
- name: Display Grid version
run: echo ${GRID_VERSION}
- name: Remove local Docker tag
run: docker rmi selenium/base:local-${BUILD_DATE}
- name: Sets env var for the next tag
run: echo ::set-env name=NEXT_TAG::"${GRID_VERSION}"-${BUILD_DATE}
- name: Get latest tag
run: echo ::set-env name=LATEST_TAG::$(git tag | tail -1)
- name: Display latest tag
run: echo ${LATEST_TAG}
- name: Update tag in docs and files
run: ./update_tag_in_docs_and_files.sh ${LATEST_TAG} ${NEXT_TAG}
- name: Build images
run: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Update tag in docs and files" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: trunk
- name: Login Docker Hub
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- name: Deploy new images
run: VERSION="${TAG}" make release
run: make release
- name: Tag browser images
run: VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} PUSH_IMAGE=true make tag_and_push_browser_images
- name: Get latest tag
run: echo ::set-env name=LATEST_TAG::$(git tag | tail -1)
- name: Display latest tag
run: echo ${LATEST_TAG}
- name: Create release notes (release_notes.md)
run: ./generate_release_notes.sh ${LATEST_TAG} origin/trunk ${GRID_VERSION} ${BUILD_DATE}
- name: Create Release
Expand All @@ -53,7 +76,8 @@ jobs:
release_name: ${{ env.GRID_VERSION }}-${{ env.BUILD_DATE }}
body_path: release_notes.md
draft: false
prerelease: false
prerelease: ${{ env.PRERELEASE }}

# Enable this part when Selenium 4 is released
# - name: Deploy tag latest
# run: VERSION="${TRAVIS_TAG}" make tag_latest
Expand Down
5 changes: 0 additions & 5 deletions generate_release_notes.sh
Expand Up @@ -7,11 +7,6 @@ BUILD_DATE=$4

TAG_VERSION=${GRID_VERSION}-${BUILD_DATE}

# Get all tags, branches, and history
#git fetch --depth=1 origin +refs/tags/*:refs/tags/* 1>&2
#git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* 1>&2
#git fetch --prune --unshallow 1>&2

echo "" >> release_notes.md
echo "### Changelog" > release_notes.md
git --no-pager log "${LATEST_TAG}...${HEAD_BRANCH}" --pretty=format:"* [\`%h\`](http://github.com/seleniumhq/docker-selenium/commit/%H) - %s :: %an" --reverse >> release_notes.md
Expand Down
15 changes: 15 additions & 0 deletions update_tag_in_docs_and_files.sh
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

LATEST_TAG=$1
NEXT_TAG=$2

echo -e "\033[0;32m Updating tag displayed in docs and files...\033[0m"
echo -e "\033[0;32m LATEST_TAG -> ${LATEST_TAG}\033[0m"
echo -e "\033[0;32m NEXT_TAG -> ${NEXT_TAG}\033[0m"

# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s/${LATEST_TAG}/${NEXT_TAG}/g"

git diff | cat

echo -e "\033[0;32m Text updated...\033[0m"

0 comments on commit 768cfe7

Please sign in to comment.