more tests 3 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update tags on mrbeam/mrb3-beamOS | ||
on: | ||
workflow_call: | ||
jobs: | ||
env: | ||
SW_AUTOMATIONS_EMAIL: ${{ env.SW_AUTOMATIONS_EMAIL }} | ||
SW_AUTOAMATIONS_NAME: ${{ env.SW_AUTOMATIONS_NAME }} | ||
update-tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout mrb3-beamOS | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: mrbeam/mrb3-beamOS | ||
path: mrb3-beamOS | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
fetch-depth: 0 # Fetch all history for all tags and branches | ||
- name: Update mrbeam-git-tags.inc | ||
run: | | ||
cd mrb3-beamOS | ||
printenv | ||
echo "SW_AUTOMATIONS_EMAIL: ${{ env.SW_AUTOMATIONS_EMAIL }}" | ||
echo "SW_AUTOAMATIONS_NAME: ${{ env.SW_AUTOMATIONS_NAME }}" | ||
git config --global user.email ${{ env.SW_AUTOMATIONS_EMAIL }} | ||
git config --global user.name ${{ env.SW_AUTOMATIONS_NAME }} | ||
# Extract repository name from the GitHub repository URL | ||
REPO_NAME=$(echo "${{ github.event.repository.url }}" | awk -F/ '{print $NF}' | sed 's/.git//') | ||
cd meta-mrbeam/recipes-core/mrbeam3 | ||
if [ $REPO_NAME = "iobeam" ]; then | ||
REPO_NAME=mrb3-${REPO_NAME} | ||
fi | ||
echo "REPO_NAME: $REPO_NAME" | ||
# Define conditions | ||
ALPHA="^v[0-9]+\.[0-9]+\.[0-9]+a[0-9]+$" | ||
STABLE="^v[0-9]+\.[0-9]+\.[0-9]+$" | ||
RC="^v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$" | ||
POST="^v[0-9]+\.[0-9]+\.[0-9]+\.post[0-9]+$" | ||
# Check if the tag is an alpha tag | ||
if [[ "${{ github.event.ref }}" =~ $ALPHA ]]; then | ||
git checkout test_automations | ||
sed -E "s/(TAG_${REPO_NAME}=\s+\")[^\"]+\"/\1${{ github.event.ref }}\"/" mrbeam-git-tags.inc > tmpfile && mv tmpfile mrbeam-git-tags.inc | ||
git add . | ||
git commit -m "Update $REPO_NAME to ${{ github.event.ref }}" | ||
git push origin test_automations | ||
# Else the tag is a stable tag or RC tag or post tag | ||
elif [[ "${{ github.event.ref }}" =~ $STABLE ]] || \ | ||
[[ "${{ github.event.ref }}" =~ $RC ]] || \ | ||
[[ "${{ github.event.ref }}" =~ $POST ]]; then | ||
git checkout stable | ||
sed -E "s/(TAG_${REPO_NAME}=\s+\")[^\"]+\"/\1${{ github.event.ref }}\"/" mrbeam-git-tags.inc > tmpfile && mv tmpfile mrbeam-git-tags.inc | ||
git add . | ||
git commit -m "Update $REPO_NAME to ${{ github.event.ref }}" | ||
git push origin stable | ||
else | ||
echo "Tag format not recognized : ${{ github.event.ref }} " | ||
fi |