-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remember me fix and initial github actions workflow
- Loading branch information
1 parent
19041ef
commit 788cfa1
Showing
4 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Build Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
docker: | ||
name: Build Server Container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set version | ||
run: echo "IMAGE_VERSION=$(date +"%y%m.%j")" >> $GITHUB_ENV | ||
- name: Show version number | ||
run: echo "Building release for version - $IMAGE_VERSION" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./server/ | ||
push: true | ||
tags: | | ||
ha-alexa-shopping-list-sync:$IMAGE_VERSION | ||
ha-alexa-shopping-list-sync:latest | ||
|
||
release: | ||
name: Release Client Version | ||
runs-on: ubuntu-latest | ||
needs: docker | ||
steps: | ||
- name: Set version | ||
run: echo "IMAGE_VERSION=$(date +"%y%m.%j")" >> $GITHUB_ENV | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create a tag | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git tag $IMAGE_VERSION | ||
git push origin $IMAGE_VERSION | ||
- name: Create a Release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: $IMAGE_VERSION | ||
release_name: $IMAGE_VERSION | ||
body: "Automated release for version $IMAGE_VERSION" | ||
draft: false | ||
prerelease: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
hass: | ||
name: Publish update to HASS Add-on repository | ||
runs-on: ubuntu-latest | ||
needs: release | ||
env: | ||
REPO_NAME: madmachinations/home-assistant-alexa-shopping-list-hass | ||
FILE_PATH: alexa_shopping_list/config.yaml | ||
steps: | ||
- name: Set version | ||
run: echo "IMAGE_VERSION=$(date +"%y%m.%j")" >> $GITHUB_ENV | ||
|
||
- name: Check out the external repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ env.REPO_NAME }} | ||
path: external-repo | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update version in YAML file | ||
run: | | ||
cd external-repo | ||
sed -i "s/^version:.*/version: '$IMAGE_VERSION'/" ${{ env.FILE_PATH }} | ||
cd ../ | ||
- name: Commit and push changes | ||
run: | | ||
cd external-repo | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add ${{ env.FILE_PATH }} | ||
git commit -m "Update version to $IMAGE_VERSION" | ||
git push origin master |
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
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
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